What does this sentence mean? $ Mainframe & nbsp; & amp; & nbsp; JFactory: getApplication (administrator? Details
$mainframe =& JFactory::getApplication('administrator');
Share:
------ Solution --------------------
Reference the getApplication function in the object JFactory. the input parameter is administrator.
------ Solution --------------------
$ Mainframe = & JFactory: getApplication ('admin ');
Call the static method getApplication in the JFactory class
As for the reference symbol "JFactory: getApplication ('admin');", the value is the same as the memory address of $ mainframe.
To put it simply ..
Assume that the value of JFactory: getApplication ('admin') after this php statement has changed.
$ Mainframe also changes.
If this referenced symbol is not used, the value of $ mainframe is still the value before JFactory: getApplication ('admin') changes.
------ Solution --------------------
$ Mainframe = & JFactory: getApplication ('admin ');
Ying writing
$ Mainframe = JFactory: getApplication ('admin ');
All php5 objects are passed by reference, and do not need to use & declaration for reference transfer.
If it is written,
Strict Standards:Only variables shocould be assigned by reference warning
JFactory is a class, and getApplication is a static method of the JFactory class.
JFactory: getApplication ('admin') returns an instance of the administrator class.
From the perspective of writing format, this should be the Singleton mode