1.安装 composer
2.更改composer的镜像
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/thinkphpC:\phpstudy_procomposer create-project topthink/think tpcomposer update topthink/framework备:安装和更新命令所在的目录是不同的,更新必须在你的应用根目录下面执行
4.安装完成后的目录
5.运行 Thinkphp6


6.安装视图模板
composer require topthink/think-view
7.模版渲染
要使用View,必须先引入 think\facade\View 门面类
fetch 方法渲染页面
namespace app\controller;
use think\facade\View;
class Index{
public function index(){
// 模板变量赋值
View::assign('name','欧阳克');
View::assign('email','oyk@php.cn');
// 或者批量赋值
View::assign([
'name' => '欧阳克',
'email' => 'oyk@php.cn'
]);
// 模板输出
return View::fetch();
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ThinkPHP6</title>
</head>
<body>
姓名:{$name}
<br>
邮箱:{$email}
</body>
</html>
备:Index类对应view下面的目录
备:index方法对应view下面的目录里的静态文件
8.安装bootstrap前端框架composer require twbs/bootstrap
 
                 
                        
                    Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号