Cakephp 2 RequestHandlerComponent没有方法beforeRender错误消息,无法分析RSS
我有两个不同的问题:Cakephp 2 RequestHandlerComponent没有方法beforeRender错误消息,无法分析RSS,cakephp,cakephp-2.3,requesthandler,Cakephp,Cakephp 2.3,Requesthandler,我有两个不同的问题: 呈现默认请求(html)时出错 呈现rss请求时出错 这是我的密码: class PagesController extends AppController { public $name = 'Pages'; public $components = array('RequestHandler'); public $helpers = array('Text'); } 下面是正常请求的代码 //problem #1: public func
class PagesController extends AppController {
public $name = 'Pages';
public $components = array('RequestHandler');
public $helpers = array('Text');
}
下面是正常请求的代码
//problem #1:
public function display() {
$path = func_get_args();
$count = count($path);
if (!$count) {
$this->redirect('/');
}
$page = $subpage = $title_for_layout = null;
if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title_for_layout = Inflector::humanize($path[$count - 1]);
}
$this->setDefaultMeta();
$this->layout = 'default';
$this->set(compact('page', 'subpage', 'title_for_layout'));
$this->render(implode('/', $path));
}
这是用于rss请求的
public function feeds(){
if( $this->RequestHandler->isRss() ){
$this->loadModel('Deal');
$arrId = $this->Deal->DealBuyCondition->listAliveID();
$posts = $this->Deal->rssFeeds($arrId);
return $this->set(compact('posts'));
}
die('rss only');
return false;
}
第一个函数返回错误:
Warning (2): call_user_func_array() expects parameter 1 to be a valid callback, class 'RequestHandlerComponent' does not have a method 'beforeRender' [CORE\Cake\Utility\ObjectCollection.php, line 132]
Warning (2): call_user_func_array() expects parameter 1 to be a valid callback, class 'RequestHandlerComponent' does not have a method 'shutdown' [CORE\Cake\Utility\ObjectCollection.php, line 132]
第二个函数没有正确地呈现为RSS
请帮助。您的CakePHP设置可能会出错
RequestHandlerComponent
确实有一个beforeRender
方法和shutdown
方法(从父Component
继承),因此这些错误很奇怪。尝试获取CakePHP的新副本