CI source references use--php to refer to demo, static variables and reference relationships

Source: Internet
Author: User
CI source references are used in common.php to load configuration and class methods

function &test ()
{
static $a = ';
if (! $a) {
$a = 2;
}
return $a;
}

$test =& test ();
Echo $test;
$test = 3;
echo Test ();

The result is 23.

References: Methods and variables that use methods point to the same piece of content: Modify the used variable, and the internal value of the method will also change

Note: Both methods and usage are required &

Static variables and reference relationships

/**
* Get Configuration Items
*/
function Config_item ($item)
{
Static $_config;

if (empty ($_config)) {

A reference cannot be assigned directly to a static variable and can be assigned to a static variable array
$_config[0] =& get_config ();
}

return $_config[0][$item];
}

CI source references use--php to refer to demo, static variables and reference relationships

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.