控制器
在当前插件controller目录下创建php文件 首字母大写规范
Index.php结构
<?php
declare(strict_types=1);
namespace app\hello\controller;//hello插件目录标识
use think\facade\View;
use think\facade\Db;
use think\facade\Request;
use app\BaseController;
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2025 All rights reserved.
// +----------------------------------------------------------------------
// | Author: @梦雨 <50361804@qq.com>
// +----------------------------------------------------------------------
class Index extends BaseController
{
public function initialize()
{
}
public function index()
{
return View::fetch('app/hello/view/index.html');//渲染到view/indexhtml
}
}