Yii执行脚本

1、编码执行
这里写图片描述

<?php

/**
 * 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启动定时任务设置窗口

猜你喜欢

转载自blog.csdn.net/eddy23513/article/details/81015183