栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP > php开源框架 > thinkphp

自定义命令行 - ThinkPHP5.0完全开发手册

thinkphp 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

自定义命令行 - ThinkPHP5.0完全开发手册

## 创建自定义命令行 第一步,配置command.php文件,目录在application/command.php ~~~ setName('test')->setDescription('Here is the remark ');     }     protected function execute(Input $input, Output $output)     {         $output->writeln("TestCommand:");     } } ~~~ 这个文件定义了一个叫test的命令,备注为Here is the remark, 执行命令会输出TestCommand。 第三步,测试-命令帮助-命令行下运行 ~~~ php think ~~~ 输出 ~~~ Think Console version 0.1 Usage:   command [options] [arguments] Options:   -h, --help            Display this help message   -V, --version         Display this console version   -q, --quiet           Do not output any message       --ansi            Force ANSI output       --no-ansi         Disable ANSI output   -n, --no-interaction  Do not ask any interactive question   -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands:   build              Build Application Dirs   clear              Clear runtime file   help               Displays help for a command   list               Lists commands   test               Here is the remark  make   make:controller    Create a new resource controller class   make:model         Create a new model class  optimize   optimize:autoload  Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.   optimize:config    Build config and common file cache.   optimize:route     Build route cache.   optimize:schema    Build database schema cache. ~~~ 第四步,运行test命令 ~~~ php think test ~~~ 输出 ~~~ TestCommand: ~~~
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/213632.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号