公共控制器 Common.php
namespace app\index\controller;
use think\Controller;
class Common extends Controller
{
function _initialize()
{
if (!session("uid")) {
return $this->redirect("Login/index");
}
}
}继承公共控制器 index.phpnamespace app\index\controller;
class Index extends Common
{
public function index()
{
return $this->fetch();
}
} 