雷达智富

首页 > 内容 > 程序笔记 > 正文

程序笔记

TP6.0 命令行生成类库文件

2024-08-31 15

1. 生成控制器


// 默认生成资源控制器,有七个方法资源操作方法// index、createsaveread、edit、updatedeletephp think make:controller Blog// 创建多级控制器php think make:controller user/Blog// 创建index应用下的Blog控制器php think make:controller index@Blog// 创建多级控制器php think make:controller index@user/Profile// 如果仅仅生成空的控制器则可以加上参数 --plainphp think make:controller User --plain// 如果只是用于接口开发,可以使用参数 --api// index、save、read、update、delete// 默认提供5个操作方法,和资源控制器相比少了 create 和 edit 方法php think make:controller User --api

2. 生成模型


php think make:model Blogphp think make:model index@Blogphp think make:model index@user/Profile

3. 生成验证器


php think make:validate Userphp think make:validate admin@Userphp think make:validate admin@user/Address

4. 生成中间件


注意:命令行不支持直接在应用下创建中间件

php think make:middleware Loginphp think make:middleware user/Login
更新于:16天前
赞一波!

文章评论

全部评论