# 控制器
<?php
namespace app\admin\controller;
use think\Request;
use think\tree;
use think\db;
class Manual extends \think\Controller
{
//构造方法 当前页面最先执行
public function __construct(){
$info =session('userInfo');
$username =$info['username'];
if(empty($username)){
header("location:/index.php/admin/user/login"); die;
}
}
public function index(){
return $this->fetch();
}
public function a(){
return view('aa/0_1');
}
public function b(){
return view('bb/1');
}
}
视图
写法:
- {$Request.session.username}
<div class="user left">
{$Request.session.userInfo.username}
</div>