thinkphp6 cli 命令行方式访问 控制器方法
2022-11-24 11:10:29
150
{{single.collect_count}}

方法来自

为了不影响当前程序,拷贝index.php文件并且命名cli.php,加入代码

if (false !== strpos(PHP_SAPI, 'cli')) {$_SERVER['REQUEST_URI'] = $_SERVER['argv'][1] ?? '';}

cd进入public目录,执行

php cli.php index/test// index是控制器,test是方法

 

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}