What does PHP mean? $ Ctrl-> $ action ();

Source: Internet
Author: User
What does PHP mean? $ Ctrl-& gt; $ action (); $ ctrl-> $ action ();

$ Ctrl is an object. what is access to this object?
--------------------------------------------------------------
The access attribute is $ ctrl-> action;
The usage class is like $ ctrl-> action ();


Reply to discussion (solution)

$ Ctrl-> $ action (); is also the name of a method called, but the name of this method is replaced by a variable $ action.

$ Ctrl-> $ action (); is also the name of a method called, but the name of this method is replaced by a variable $ action.


What does this mean? Could you give me a simple example ??

Function fn (){
Echo 1;
}

$ Fn = 'FN ';
$ Fn ();

It is nothing more than putting the function or object method name variables in and running.
However, we recommend that you use function_exist and method_exist to check

Function fn (){
Echo 1;
}

$ Fn = 'FN ';
$ Fn ();

It is nothing more than putting the function or object method name variables in and running.
However, we recommend that you use function_exist and method_exist to check


Thank you. you can understand it in this way ...~

$ Ctrl-> {$ action} (); actually, the value of the $ action variable is treated as a method of the $ ctrl class.

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.