ThinkPHP入门 #

一、安装 #

bash
composer create-project topthink/think myapp
cd myapp
php think run

二、目录结构 #

text
app/
├── controller/
├── model/
├── view/
config/
route/

三、控制器 #

php
<?php
namespace app\controller;

class User
{
    public function index()
    {
        return 'Hello ThinkPHP!';
    }
}

四、路由 #

php
<?php
use think\facade\Route;

Route::get('user/:id', 'User/read');

五、总结 #

本章学习了ThinkPHP入门,恭喜你完成了PHP完全指南的学习!

最后更新:2026-03-26