"치명적인 오류 : 정의되지 않은 함수 getSContent()를 호출합니다."포함 된 코드로 ... 볼 수 있듯이 : 내 함수가 바로 있습니다!"누락 된 기능"오류가 발생하는 이유는 무엇입니까? 내 기능이 바로 거기에있다!
도와주세요. 나는 잠이 필요하다고 확신한다.
class InfoController extends AppController {
var $name = 'Info';
var $helpers = array('Html', 'Session');
var $uses = array();
function display() {
$path = func_get_args();
$section = $path[0];
$mainMenuActiveElement = $section;
$sectionContent = getSContent($section);
$this->set(compact('section', 'mainMenuActiveElement', 'sectionContent'));
$this->render('/pages/info');
}
function getSContent($section) {
$sectionContent = '';
switch ($section) {
case 'bases':
$sectionContent = 'some content';
break;
case 'informacion':
$sectionContent = 'some other content';
break;
}
return $sectionContent;
}
}
오! 나는 정말로 가서 잠을 자야 해. 고맙다 @ VolkerK! – vmarquez
그리고 "암묵적으로 ..."라고 생각하지 않아서 유감입니다. http://en.wikipedia.org/wiki/Name_resolution – VolkerK
PHP에서는 의미가 없습니다. http://stackoverflow.com/questions/3345408/what-is-the-point-of-having-this-and-self-in-php/3376490#3376490 – Artefacto