gpt4 book ai didi

php - 如何修复通知 : Only variable references should be returned by reference in

转载 作者:搜寻专家 更新时间:2023-10-31 20:37:40 30 4
gpt4 key购买 nike

我正在使用从 torrenteditor 获取的 php 脚本来创建 torrent 文件,但是当我使用指定的方法创建新的 torrent 文件时,torrent 文件被创建但我收到很多通知。,就像这样

在第 319 行的 myfile.php 中,仅应通过引用返回变量引用

在这条线上

return new BEncode_End();

指定为另一个类

class BEncode_End
{
public function get_type()
{
return 'end';
}
}

那么我该如何解决这个通知呢?

我对类(class)很陌生,所以不知道从哪里开始。

完整的脚本/代码上传到这里http://pastebin.com/L6ktvrne , 第 319 行

我正在使用

ini_set('display_errors', 1); 
error_reporting(E_ALL);

最佳答案

根据您收到的通知和 answer to another related question :

In PHP assignment expressions always return the assigned value. So $_config[0] =& $config returns $config - but not the variable itself, but a copy of its value. And returning a reference to a temporary value wouldn't be particularly useful (changing it wouldn't do anything).

更改您的代码:

return new BEncode_End();

收件人:

$cl = new BEncode_End();
return $cl;

应该可以解决您的问题。

关于php - 如何修复通知 : Only variable references should be returned by reference in,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31096694/

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