TP6 常用指令

2021-05-27  本文已影响0人  泡水鱼干

1、安装composer

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

2、composer镜像切换

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
composer config -g --unset repo.packagist
composer config -gl

3、安装

composer create-project topthink/think=6.0.* [目录名=think]

4、运行

php think run -p 80

5、多应用模式添加

composer require topthink/think-multi-app

6、创建中间件

app/middleware目录下面生成一个Check中间件

php think make:middleware Check

7、生成服务类

php think make:service  FileSystemService

8、控制其类创建

php think make:controller Index
php think make:controller admin@Index
php think make:controller user/Profile

php think make:controller admin@user/Profile

9、生成模型类

// 单应用
php think make:model User

// 多应用
php think make:model admin@User

// 多级目录模型
php think make:model admin@user/Profile

10、引入视图扩展

composer require topthink/think-view

11、使用 trace 调试

composer require topthink/think-trace --dev

12、关闭 trace 调试

composer remove topthink/think-trace --dev

13、验证器类生成

在app目录下生成验证器类

php think make:validate User
php think make:validate admin/User

在应用目录下生成验证器类

php think make:validate admin@User

14、生成应用

// 快速生成一个demo应用
php think build demo

// 快速生成一个index应用
php think build index

// 快速生成一个admin应用
php think build admin
上一篇 下一篇

猜你喜欢

热点阅读