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();
}
}
(相关教程推荐:yii框架)
2、cmd执行yiic.bat Test Index
或yiic Test Index
3、windows定时执行
生成脚本.bat文件D:\phpStudy\WWW\wwwerp\protected\yiic.bat ebaycrontab run
添加定时任务:
taskschd.msc启动定时任务设置窗口
更多编程相关内容,请关注php中文网编程入门栏目!