微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php-如何修复注意:在引用中,只应返回变量引用

我正在使用从torrenteditor获取PHP脚本创建torrent文件,但是当我创建新的torrent文件时,使用指定的方法创建了torrent文件,但是我收到了很多通知.

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

在这条线上

return new BEncode_End();

被指定为另一个

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

那么我该如何解决通知

我上课很新,所以不知道从哪里开始.

完整的脚本/代码在这里上传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;

应该解决你的问题.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐