批改状态:合格
老师批语:完成的不错,继续加油
控制器
<?phpnamespace app\controller;use app\BaseController;use think\facade\Db;class Index extends BaseController{public function index(){$db1 = Db::connect('php2')->name('admin_role')->select();$db = Db::name('admin')->select();dump($db1,$db);}}
页面

路由文件
<?phpuse think\facade\Route;Route::get('think', function () {return 'hello,ThinkPHP6!';});Route::get('hello/:name', 'index/hello');Route::rule('i','index');
页面
composer require topthink/think-multi-app //多应用模式扩展
后台管理系统
<?phpnamespace app\admin\controller;use app\BaseController;class Index extends BaseController{public function index(){return '我是后台';}}

博客
<?phpnamespace app\index\controller;use app\BaseController;use think\facade\Db;class Index extends BaseController{public function index(){return '我是博客';}}

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号