yii如何执行php脚本

yii如何执行php脚本,第1张

yii如何执行php脚本

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中文网编程入门栏目!

以上就是yii如何执行php脚本的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/701908.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-23
下一篇 2022-04-23

发表评论

登录后才能评论

评论列表(0条)

保存