我收到以下代码的错误
class Myclass {
//...variables
public function getName() {
return $this->strName;
}
public function checkDup() {
if(empty($this->getName())) { //HERE IS THE ERROR
$strMessage = 'Please Enter First Name';
return $strMessage;
}
}
}
$a = new Myclass (); //assume constructor is present and variables are set in class
$a->checkDup();
有什么解决办法?我的 getName() 函数返回变量的名称