The call method of this class prompts me Calltoundefinedfunction .. the newbie asks for advice. This post was last edited by Ritsu _ at 15:32:29.
PHP functions
I am a beginner in php for just one week.
The error "Call to undefined function" occurred when calling methods in this class directly. please advise.
Not much. thank you;
The code is as follows:
class wxc{echo hqwidn('aaa')."
";echo hqyj('bbb');private function hqwidn($iname) { switch ($iname) { case"oVk2sjnVaZjS4R3k9xPlfQUeuIiI":$idname="aaa"; break; case"oVk2sju_2KaRJmaByHTnkxpFxpPE":$idname="bbb";break; case"ccc":$idname="ccc";break; default :$idname="none";break; } return $idname; } private function hqyj($iname) { switch ($iname) { case"a":$mailadrs="aaa@qq.com"; break; case"b":$mailadrs="bbb@qq.com";break; case"c":$mailadrs="ccc@qq.com";break; default :$mailadrs="none";break; } return $mailadrs; }}
Reply to discussion (solution)
$ This-> hqwidn
Writing hqwidn directly is to call an out-of-class function.
$ This-> hqwidn
Writing hqwidn directly is to call an out-of-class function.
Thank you for using php recently when I used NET. I have read a lot about it, but I haven't seen the creation of classes and functions ......
In addition, you write this incorrectly.
Class initialization should be performed using constructors
Function _ construct (){
Print "In BaseClass constructor \ n ";
}
If it's just a casual test, I'm not sure.
In addition, you write this incorrectly.
Class initialization should be performed using constructors
Function _ construct (){
Print "In BaseClass constructor \ n ";
}
If it's just a casual test, I'm not sure.
I have never studied these profound questions. if you can give me a link or DEMO, thank you very much !!!
In the comments manual on the official website, many examples are as follows: