采集网站 相关文件--ArticleController.php [ 1.0 版本 ]
YII2网站采集
(1)QueueController.php
(2)ArticleController.php
(3)ArticleJob.php
(4)ArticleSpider.php
(5)YiichinaSpider.php
<?php
namespace console\controllers;
use yii\console\Controller;
use yii\web\NotFoundHttpException;
class ArticleController extends Controller{
    /*
    * cd /www/test/advanced/myYii      进入项目目录
    * ps aux|grep yii      查看是否在后台运行  php yii queue/run
    *如果没有后台运行
    * QUEUE=* php yii queue/run &
     *
     * 采集文章的时候
     * php yii article/run php100
    * */
    public function actionRun($name){
        $className = '\console\models\\'.ucfirst(strtolower($name)).'Spider';
        if(!class_exists($className)){
            throw new NotFoundHttpException($className.' Class not found');
        }
        $spider = new $className();
        $spider->process();
    }
}
specialnot
            注册时间:2015-08-06
最后登录:2019-08-16
在线时长:27小时54分
    最后登录:2019-08-16
在线时长:27小时54分
- 粉丝43
- 金钱1175
- 威望200
- 积分3445

共 0 条评论