用户
 找回密码
 入住 CI 中国社区
搜索
查看: 5826|回复: 2
收起左侧

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

[复制链接]
发表于 2009-3-16 23:03:03 | 显示全部楼层 |阅读模式
如题,今天看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[0] =& $config;
}
return $main_conf[0];
}
请大家解释一下含义?
还有定义为static的变量 的作用是说明?
发表于 2009-3-23 10:41:57 | 显示全部楼层
同学听说过“引用传递”么?
发表于 2009-3-23 14:25:46 | 显示全部楼层
& 和C 语言的一样,取地址符号,传地址值

本版积分规则