Thinkphp3.2.2 _initialize 问题

浏览:7537 发布日期:2014/06/05 分类:求助交流 关键字: _initialize
3.1.3写法是CommonAction.class.php
-----------------------------------
Class CommonAction extends Action{
    Public function _initialize(){
        if (!isset($_SESSION['id'])){
          $this->error('你没有权限,请重新登录', '__APP__/Login'); 
        }
   }

IndexAction.class.php
-------------------
class IndexAction extends CommonAction {
}
这样是没问题的,但是3.2.2有点迷糊了,是怎么写呢?CommonController.class.php
----------------

namespace Admin\Controller;
use Think\Controller;


Class CommonController extends Controller{
    
    
    
    Public function _initialize(){
        if (!isset($_SESSION['id'])){
           $this->error('你没有权限,请重新登录', '__APP__/Login'); 
        }
   }

IndexController.class.php
------------------------------

namespace Admin\Controller;
use Think\Controller;

class IndexController extends CommonController{
}
结果运行是

Namespace declaration statement has to be the very first statement in the script
错误位置
FILE: C:\Users\Administrator\desktop\phpStudy\WWW\AimeeBlog3.2.2\Blog\Admin\Controller\CommonController.class.php  LINE: 3


求大神 ~~~~~
最佳答案
评论() 相关
后面还有条评论,点击查看>>