今天想重构下代码结构: BaseController.php 放置公共的中间件 class BaseController { public function __construct(){ $this->middleware('login'); } } IndexController.php 继承 BaseController class IndexController extends BaseController { $user; // 存储登录用户实例 public function __co
public function __construct() { parent::__construct( ); parent::__construct( ); if(!APP_DEBUG ) die('not supported now'); //上一行没有分号.默认安装一行来算 } public function liyan() { $this->display(); } Call to a member function display() on a non-object $this->不
01父类抽象类 abstract.php <?phpabstract class controller_abstract{ protected $app; function __construct(& $app){ $this->app = $app;} public function exec(){ call_user_func_array(array($this->app->class,$this->app->action),array($this->