YII 系统命令行生成代码
代码 生成 yii 系统命令
2023-09-14 08:59:48 时间
你当前显示的是与shell交互的提示符。你可以输入help查看shell为你提供的所有命令列表
help At the prompt, you may enter a PHP statement or one of the following commands: - controller - crud - form - help - model - module Type help command-name for details about a command.
我们看了有几个可选的命令,有一个controller命令看起来象是我们想要的,可能是用来为应用程序创建一个控制器的命令。我们可以在shell提标符下进一步了解controller命令的更多帮助信息。这些信息包括提供的用法说明,参数描述和一些例子。
DESCRIPTION This command generates a controller and views associated with the specified actions. PARAMETERS * controller-ID: required, controller ID, e.g., post. If the controller should be located under a subdirectory, please specify the controller ID as path/to/ControllerID, e.g., admin/user. If the controller belongs to a module, please specify the controller ID as ModuleID/ControllerID or ModuleID/path/to/Controller (assuming the controller is under a subdirectory of that module). * action-ID: optional, action ID. You may supply one or several action IDs. A default index action will always be generated. EXAMPLES * Generates the post controller: controller post * Generates the post controller with additional actions contact and about: controller post contact about * Generates the post controller which should be located under the admin subdirectory of the base controller path: controller admin/post * Generates the post controller which should belong to the admin module: controller admin/post
阅读帮助,很明显看出该命令会生成控制器和操作方法及视图文件。由于我们将要做的应用程序主要是显示一条消息,让我们调用controller message 和一个要显示的操作方法:
generate MessageController.php mkdir /Webroot/demo/protected/views/message generate helloworld.php generate index.php Controller message has been created in the following file: /Webroot/demo/protected/controllers/MessageController.php You may access it in the browser using the following URL: http://hostname/path/to/index.php?r=message
If you have a db database connection, you can test these models now with: $model=User::model()- find(); print_r($model);
mkdir E:/Apache2/htdocs/webapp/protected/modules mkdir E:/Apache2/htdocs/webapp/protected/modules/wiki mkdir E:/Apache2/htdocs/webapp/protected/modules/wiki/components mkdir E:/Apache2/htdocs/webapp/protected/modules/wiki/controllers generate controllers/DefaultController.php mkdir E:/Apache2/htdocs/webapp/protected/modules/wiki/messages mkdir E:/Apache2/htdocs/webapp/protected/modules/wiki/models mkdir E:/Apache2/htdocs/webapp/protected/modules/wiki/views mkdir E:/Apache2/htdocs/webapp/protected/modules/wiki/views/default generate views/default/index.php mkdir E:/Apache2/htdocs/webapp/protected/modules/wiki/views/layouts generate WikiModule.php Module wiki has been created under the following folder: E:\Apache2\htdocs\webapp\protected\modules\wiki You may access it in the browser using the following URL: http://hostname/path/to/index.php?r=wiki Note, the module needs to be installed first by adding wiki to the modules property in the application configuration.
相关文章
- 无需CORS,用nginx解决跨域问题,轻松实现低代码开发的前后端分离
- php代码获取WordPress网站所有的文章链接
- 在线客服系统源码开发实战总结:需求分析及前端代码基本技术方案
- java通过jdbc连接sql server数据库_mysqljdbc连接数据库代码
- 使用Visual Python自动生成代码
- 解放双手!根据代码自动生成时序图,这款IDEA插件真香!
- 使用GitPod操作远程工程代码
- php时间戳,php时间代码合集,时间日期转换
- 网页访问添加提示代码
- 1行代码计算肿瘤突变负荷TMB
- 从0开始聊聊自动化静态代码审计工具
- 尝试 IIncrementalGenerator 进行增量 Source Generator 生成代码
- 根据wsdl,axis2工具生成客户端代码详解程序员
- 根据URL抓取并生成缩略图的Java代码详解编程语言
- 最简单易懂的GAN(生成对抗网络)教程:从理论到实践(附代码)
- ASP动态生成的javascript表单验证代码
- 再来个专门为google量身定做的sitemap生成代码,(可是动态的哦)
- 用PHP生成html分页列表的代码
- 纯CSS生成抗锯齿圆角的代码
- Iframe自适应高度并实时监控高度变化的js代码
- php获取一个月第一天与最后一天的代码
- win2003补丁iis应用程序池无法启动进程退出代码是0xffffffff
- JQuery循环滚动图片代码
- javascript判断中文字符长度的函数代码
- php生成局部唯一识别码LUID的代码
- asp.net生成随机密码的具体代码
- php生成短网址原理及代码
- 手机端网页点击链接触发自动拨打或保存电话的示例代码