<?php namespace Home\Controller; use Think\Controller; class CommonController extends Controller { public function _initialize(){ if(!isset($_SESSION['phone'])){ $this->redirect('Home/Login/index'); } } }