What does this sentence mean? Excuse me-php Tutorial

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

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.