0
我想在我的Laravel 3.2中的基本控制器中獲取當前的控制器名稱,但它返回null。在我的主控制器中沒有問題。Base_Controller:在Laravel中訪問當前的控制器名稱
我怎樣才能得到這個值在我的Base_Controller
?
<?php
class Base_Controller extends Controller {
public $page_data = array();
public function __call($method, $parameters) {
return Response::error('404');
}
public function __construct() {
$this->page_data['body_id'] = Request::$route->controller;
parent::__construct();
}
}
真棒謝謝!無論如何,控制器的行動呢? – i52poutine 2013-02-10 08:52:29
當然,請檢查:[http://stackoverflow.com/questions/2115913/retrieving-the-name-of-the-current-function-in-php](http://stackoverflow.com/questions/2115913/檢索最名稱的最電流函數功能於PHP) – Panais 2013-02-10 08:56:44