$ This-& gt; $ function () in PHP? Dear friends, recently, my younger brother is reading the code of group buying every day. The result shows this code in/modules/index. mod. php:
function ModuleObject( $config ){$this->MasterObject($config);$runCode = Load::moduleCode($this);$this->$runCode();}
In the fifth line of code, $ this-> $ runCode (); does this sentence have any special meaning in PHP? I am not trained in PHP, so I don't understand some basic rules that are not commonly used. I hope you will be grateful for your guidance.
Reply to discussion (solution)
This is a class, and the code is more than that.
Class ModuleObject extends MasterObject {function ModuleObject ($ config) {$ this-> MasterObject ($ config); $ runCode = Load: moduleCode ($ this ); $ this-> $ runCode ();} function Main () {$ clientUser = get ('u', 'int'); if ($ clientUser! = '') {Handler ('cookier')-> setVar ('finderid', $ clientUser); handler ('cookier')-> setVar ('findtime ', time () ;}$ data = logic ('product')-> display (); $ data | header ('Location :'. rewrite ('? Mod = subscribe & code = mail '); $ product = $ data ['product']; $ this-> Title = $ data ['mutidview']? '': $ Product ['name']; include handler ('Template')-> file ($ data ['file']);} function ExpressConfirm () {$ oid = $ this-> Get ['id']; $ result = $ this-> OrderLogic-> orderExpressConfirm ($ oid); if ($ result) {$ this-> Messager (_ ('receipt confirmed. this transaction is complete! '),'? Mod = me & code = order');} else {$ this-> Messager (_ ('invalid order number! '),'? Mod = me & code = order ');}}}
This is the code of the class. I have checked the parent class and this class, and there are no related functions.
Manual cloud:
Variable functions
PHP supports the concept of variable functions. This means that if a variable name has parentheses, PHP will look for a function with the same name as the value of the variable and will try to execute it.
Manual cloud:
Variable functions
PHP supports the concept of variable functions. This means that if a variable name has parentheses, PHP will look for a function with the same name as the value of the variable and will try to execute it.
Are there any restrictions on the domain searched by the predecessors? For example: all non-class functions in the currently referenced file/all non-class and class member functions in the currently referenced file/all class static functions in the currently referenced file/
$ This-> $ runCode ();
This must be in your class.
Class ModuleObject extends MasterObject
Go to his parent class and public class to search
Go to the configuration file config. php (usually called this) and check the introduced class file.
$ RunCode = Load: moduleCode ($ this );
$ This-> $ runCode ();
Does the $ runCode in the second line have a relationship with the $ runCode in the first line?
$ RunCode = Load: moduleCode ($ this );
$ This-> $ runCode ();
Does the $ runCode in the second line have a relationship with the $ runCode in the first line?
This has been found, as said on the third floor, the variable function, the string returned by $ runCode in the first line represents the function name. Example:
$func = 'Main'; $func(); function Main(){ echo "This is a variable function"; }
The Main function is run, and the searched domain is a non-member function within the scope of the variable.
Is in the execution class
$ RunCode
This function.
See echo $ runCode.
I want to ask extends MasterObject
Where is the inherited parent class?
Is it a basic php class?
Cannot find MasterObject