Php Kohana未定义属性:请求::$action
我正在尝试使用本教程设置我的第一个Kohana网页- 按照说明操作后,我在第49行留下了这个错误-未定义的属性:Request::$action 这是DefaultTemplate.php中与该行相关的代码Php Kohana未定义属性:请求::$action,php,properties,undefined,kohana,Php,Properties,Undefined,Kohana,我正在尝试使用本教程设置我的第一个Kohana网页- 按照说明操作后,我在第49行留下了这个错误-未定义的属性:Request::$action 这是DefaultTemplate.php中与该行相关的代码 48 if (!$view){ 49 $view = 'pages/'.$this->request->controller().'/'.$this->request->action.'_tpl'; 50 } 51 $this->
48 if (!$view){
49 $view = 'pages/'.$this->request->controller().'/'.$this->request->action.'_tpl';
50 }
51 $this->template->content = View::factory($view, $this->data);
52 }
53 }
54 ?>
这是由News.php调用的,它是呈现某些内容的标准调用
class Controller_News extends Controller_DefaultTemplate {
public function __construct(\Request $request, \Response $response) {
parent::__construct($request, $response);
}
public function action_index(){
$this->render();
}
}
用于获取此错误的程序的完整列表为:
APPPATH/classes/Controller/DefaultTemplate.php [ 49 ] » Kohana_Core::error_handler(arguments)
APPPATH/classes/Controller/News.php [ 13 ] » Controller_DefaultTemplate->render()
SYSPATH/classes/Kohana/Controller.php [ 84 ] » Controller_News->action_index()
{PHP internal call} » Kohana_Controller->execute()
SYSPATH/classes/Kohana/Request/Client/Internal.php [ 97 ] » ReflectionMethod->invoke(arguments)
SYSPATH/classes/Kohana/Request/Client.php [ 114 ] » Kohana_Request_Client_Internal- >execute_request(arguments)
SYSPATH/classes/Kohana/Request.php [ 997 ] » Kohana_Request_Client->execute(arguments)
DOCROOT/index.php [ 118 ] » Kohana_Request->execute()APPPATH/classes/Controller/News.php [ 13 ] » Controller_DefaultTemplate->render()
SYSPATH/classes/Kohana/Controller.php [ 84 ] » Controller_News->action_index()
{PHP internal call} » Kohana_Controller->execute()
SYSPATH/classes/Kohana/Request/Client/Internal.php [ 97 ] » ReflectionMethod->invoke(arguments)
SYSPATH/classes/Kohana/Request/Client.php [ 114 ] » Kohana_Request_Client_Internal->execute_request(arguments)
SYSPATH/classes/Kohana/Request.php [ 997 ] » Kohana_Request_Client->execute(arguments)
DOCROOT/index.php [ 118 ] » Kohana_Request->execute()
任何帮助都将不胜感激。本教程已有4年历史,因此可能有点过时 使用当前版本的Kohana,您可以通过以下操作访问受保护的属性
$request->\u action
:
$this->request->action();
请毫不犹豫地检查system/classes/Kohana
中的源代码,这些代码清晰且注释良好