Yii执行脚本

1、编码执行
Yii执行脚本_第1张图片

/** * Created by PhpStorm. * User: Administrator * Date: 2018/4/12 0012 * Time: 下午 5:43 */

/** * 示例代码 * Class TestCommand */
class TestCommand extends CConsoleCommand
{
    /** * * 测试(项目根目录下执行) * * 脚本执行示例: * windows环境: * >yiic.bat Test Index * linux环境: * >yiic Test Index */
    public function actionIndex()
    {
        echo "ok";
        exit();
    }
}

2、cmd执行:
这里写图片描述

这里写图片描述

3、windows定时执行
生成脚本.bat文件

D:\phpStudy\WWW\wwwerp\protected\yiic.bat ebaycrontab run

添加定时任务:

taskschd.msc启动定时任务设置窗口

你可能感兴趣的:(PHP,Yii2,Yii1.1)