框架下载:
这里的 tp 目录名你可以任意更改,这个目录就是我们后面会经常提到的应用根目录。
composer create-project topthink/think tp
如果你之前已经安装过,那么切换到你的应用根目录下面,然后执行下面的命令进行更新:
composer update topthink/framework
更新操作会删除thinkphp目录重新下载安装新版本,但不会影响app目录,因此不要在核心框架目录添加任何应用代码和类库。
生成资源控制器:
php think make:controller User
模板引擎:
如果你需要使用think-template模板引擎,只需要安装think-view 模板引擎驱动。
composer require topthink/think-view
注解路由扩展:
composer require topthink/think-annotation
生成验证类:
php think make:validate User
多应用模式扩展:
composer require topthink/think-multi-app