bigdog24 发表于 2009-3-16 23:03:03

请问 php函数前面加 &是什么意思?

如题,今天看ci的源码common.php ,其中有很多函数的前面都有 &,如下
function &get_config()
{
static $main_conf;
if ( ! isset($main_conf))
{
if ( ! file_exists(APPPATH.'config/config'.EXT))
{
   exit('The configuration file config'.EXT.' does not exist.');
}
require(APPPATH.'config/config'.EXT);
if ( ! isset($config) OR ! is_array($config))
{
   exit('Your config file does not appear to be formatted correctly.');
}
$main_conf =& $config;
}
return $main_conf;
}
请大家解释一下含义?
还有定义为static的变量 的作用是说明?

lizart 发表于 2009-3-23 10:41:57

同学听说过“引用传递”么?

le_el 发表于 2009-3-23 14:25:46

& 和C 语言的一样,取地址符号,传地址值
页: [1]
查看完整版本: 请问 php函数前面加 &是什么意思?