Calling the method of this class prompts me Calltoundefinedfunction .. new users are asking for advice

Source: Internet
Author: User
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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.