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
或
立即学习“PHP免费学习笔记(深入)”;
yiic Test Index
3、windows定时执行
生成脚本.bat文件
D:\phpStudy\WWW\wwwerp\protected\yiic.bat ebaycrontab run
添加定时任务:
taskschd.msc启动定时任务设置窗口
更多编程相关内容,请关注php中文网编程入门栏目!
以上就是yii如何执行php脚本的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号