Chinaunix首页 | 论坛 | 博客
  • 博客访问: 72741
  • 博文数量: 27
  • 博客积分: 1880
  • 博客等级: 上尉
  • 技术积分: 505
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-16 08:51
文章分类

全部博文(27)

文章存档

2008年(27)

我的朋友
最近访客

分类:

2008-03-01 09:33:36

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in c:\...\www\demo\vant.php on line

PHP.ini在PHP的一些版本中默认allow_call_time_pass_reference为Off 即不允许运行时传递引用变量..
[code]

function func($a)
{
$a = 'test';
}

$xx = '';

func(&$xx); // 默认情况下会有出错提示...

你要么改函数的声明成:

function func(&$a)
{
$a = 'test';
}

$xx = '';

func($xx);

[/code]

或改php.ini中allow_call_time_pass_reference为On

笔者的PHP5的php.ini的allow_call_time_pass_reference默认为on,特意改成off。

PS: 在运行时传递引用不是一个好习惯..

以下是本人的一个练习:
[code]
function func1(&$a)
{
echo '$xx初值为:'.$a.'
';
$a="中国";
}

$xx = '测试';
func1($xx);
echo '最后$xx的值为:'.$xx.'

';
?>
function func2($a)
{
echo '$xx初值为:'.$a.'
';
$a="中国";
}

$xx = '测试';
func2($xx);
echo '最后$xx的值为:'.$xx;

?>

[/code]

阅读(537) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:贫贱夫妻百事哀 宁不爱也不要贫穷的爱

给主人留下些什么吧!~~