我遇到了cakephp控制器的问题我一直收到错误
未定义的属性:AdsController :: $ getUrlsHTML
public function getUrlsHTML($UrlId = 0) {
// Called via AJAX to get HTML for CTAs
// Provides insertable HTML based on list from getCalloutsActionsList()
$this->layout = 'ajax';
$UrlsList = $this->getUrlsActionsList($UrlId);
$this->set('Urls', $UrlsList);
$this->set('url', $UrlId);
$this->render('/elements/ads/url');
}
private function getUrlsActionsList($UrlId = 0) {
// Pulls appropriate Callouts list. Usually called by getCalloutsHTML()
$Urls = $this->getUrlsHTML->getUrls();
$UrlsList = array();
foreach ($Urls as $Url) {
$UrlsList[$Url['url']['id']] = $Url['url']['text'];
}
return $UrlsList ;
}
答案 0 :(得分:0)
您的控制器中是否声明了属性“getUrlsHTML”?我只能看到函数getUrlsHTML,所以你必须使用$ this-> getUrlsHTML()来调用它。
答案 1 :(得分:0)
此
$this->getUrlsHTML->getUrls();
无效。你想做什么?
错误确切地说明了你的问题是什么,getUrlsHTML
不是属性,意思是“你为什么把它当作变量?”
是
$this->getUrlsHTML()
调用该函数,或
$this->getUrlsHTML()->getUrls();
如果你想连接。