thinkphp5.一、thinkphp6

下载原装:https://packagist.org/packages/topthink/thinkphp

composer create-project topthink/think tp 6.0.*-dev

文档地址html

5.1取消了全部的系统常量thinkphp

5.1新特性app

容器、门面、中间件composer

 

 控制器支持模型的依赖注入fetch

//须要use user的命名空间
public
function demo(User $user){ $user->db()->find(uid:4); }

aplication 目录变为appui

view视图层从app同级且须要手动引入think\view视图类spa

namespace app\index\controller
use
think\facade\View; class Index { public function index() { // 模板变量赋值 View::assign('name','ThinkPHP'); View::assign('email','thinkphp@qq.com'); // 或者批量赋值 View::assign([ 'name' => 'ThinkPHP', 'email' => 'thinkphp@qq.com' ]); // 模板输出 return View::fetch('index'); } }

对用模版文件 view/index/index.html

 

配置文件细化code

 

6.0(5.2):改变细节htm

应用目录将aplication改成app

核心类库有thinkphp移至vendor

取消了本来的think\Loader

...

相关文章
相关标签/搜索