dongtan9518 2015-10-14 14:07
浏览 49
已采纳

结束(爆炸)严格标准:只有变量应该通过引用传递

I have this code to get the extension of a file:

$extension = end(explode(".", $_FILES["rfile"]["name"]));

That is working fine on localhost, but when I upload online hosting, it is giving me this error:

Strict Standards: Only variables should be passed by reference in...

  • 写回答

3条回答 默认 最新

  • duancuo1234 2015-10-14 14:15
    关注

    Why not use pathinfo (PHP >= 4.0.3), i.e.:

    $ext = pathinfo($_FILES["rfile"]["name"])['extension'];
    

    Live PHP demo

    http://ideone.com/eMpbnL

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法