严格的标准:仅变量应通过引用传入. [英] Strict Standards: Only variables should be passed by reference in..

查看:92
本文介绍了严格的标准:仅变量应通过引用传入.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试上传图像时出现错误.图片总是上传的,但是每次上传后,我都会收到此错误:

I am receiving an error when I attempt to upload an image. The image is always uploaded, but after every upload I receive this error:

严格标准:只有变量应通过引用传递给 /filemanager/afmlib.php,第57行

Strict Standards: Only variables should be passed by reference in /filemanager/afmlib.php on line 57

我的文件管理器中的第57行是:

Line 57 in my filemanager is:

 function AFM_fileExt($filename)
 {
  return strtolower(end(explode('.', $filename)));////THIS IS LINE: 57
 }

我该如何解决?

推荐答案

为什么不让PHP来做这项工作:

Why not let PHP do the work:

function AFM_fileExt($filename) {
    return strtolower(pathinfo($filename, PATHINFO_EXTENSION));
}

出于完整性考虑,此答案很好地解释了错误是如何产生的.这是因为 end(array &$array) 使用了引用-注意声明中的&"号.

For the sake of completeness, this answer gives a good explanation of how the error arises. It's because end(array &$array) uses a reference - note the ampersand in the declaration.

这篇关于严格的标准:仅变量应通过引用传入.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆