gpt4 book ai didi

php - "Call-time pass-by-reference has been removed"

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:55:07 25 4
gpt4 key购买 nike

我正在尝试使用此存储库在 Dotcloud 上部署 Wordpress,但日志中出现错误:

18:59:19: [www.0] Running postinstall script...
18:59:21: [www.0] PHP Fatal error: Call-time pass-by-reference has been removed in /home/dotcloud/rsync-1353715101184/dotcloud-scripts/feed-wp-config.php on line 86

查看line 86 in feed-wp-config.php ,内容如下:

$content = preg_replace('/(define\(\'' . $property . '\', \')(.*)(\'\);)/', '${1}' . $value . '${3}', $content, -1, &$count);

当我转到 Wordpress 起始页时,它说,“似乎没有 wp-config.php 文件。在我们开始之前我需要这个。”

我已经 cross-posted this to the repo's Github issue tracker , 但由于还没有回复,我也将其张贴在这里,希望有人知道答案。

最佳答案

&$count 替换为 $count& 表示您希望通过引用而不是值传递变量:

Documentation says

There is no reference sign on a function call - only on function definitions. Function definitions alone are enough to correctly pass the argument by reference. As of PHP 5.3.0, you will get a warning saying that "call-time pass-by-reference" is deprecated when you use & in foo(&$a);.

所以如果你想通过函数的引用传递变量,你应该在函数声明中使用&:

现在应该这样做:

// right
function foo(&$var) {
...
}

foo($foo);

但不是那样(当您收到此警告时):

function foo($var) {
...
}

foo(&$foo); // <--- wrong

关于php - "Call-time pass-by-reference has been removed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13553698/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com