Home  >  Article  >  php教程  >  tp5 rc 3 控制器的继承实例

tp5 rc 3 控制器的继承实例

WBOY
WBOYOriginal
2016-06-07 11:34:371267browse

关于tp5 rc 3 控制器的继承实例
公共控制器 Common.phpnamespace app\index\controller;<br> use think\Controller;<br> class Common extends Controller<br> {<br>     function _initialize()<br>     {<br>        if (!session("uid")) {<br>          return $this->redirect("Login/index"); <br>        }<br>     }<br> <br> }继承公共控制器 index.phpnamespace app\index\controller;<br> class Index extends Common<br> {<br>     public function index()<br>     {<br>         return $this->fetch();<br>     }<br> <br> }

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn