/**
  * Creates a new CrawlerUrlContent model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new CrawlerUrlContent();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Пример #2
0
 /**
  * 把采集到的内容写如到数据库
  * @param $crawlerUrlId
  * @param $content
  */
 public function addCrawlerUrlContent($crawlerUrlId, $content)
 {
     if (is_array($content)) {
         $content = implode(',', $content);
     }
     $crawlerUrlContent = new CrawlerUrlContent();
     $crawlerUrlContent->url_id = $crawlerUrlId;
     $crawlerUrlContent->url_content = $content;
     $crawlerUrlContent->save();
     $error = $crawlerUrlContent->getErrors();
 }