php中使用end方法报错

  1. <b>Strict Standards</b>:  Only variables should be passed by reference in <b>

    1.如果在使用end()时出现这个错误,那么原因可能是参数的问题,让我们找到手册中的end()函数API,如图所示;

    Only variables should be passed by referen
  2.  

    2.可以看到end的参数是一个引用(reference),如果把一个变量的引用作为一个参数传给函数,是没有任何问题的,但是如果把一个变量的分割表达式直接作为参数传给end()函数,就会出现这个错误;

    Only variables should be passed by referen
  3.  

    3.解决方案:

    <1>$temp = explode(',', $example);

    return end($temp);

    先将需要分割的变量分割成数组,保存到一个临时变量中,然后使用end()函数

    <2>更改错误配置:

    error_reporting(E_ALL ^ E_NOTICE);

    Only variables should be passed by referen
  4. 4

    4.在安装Ecshop时,可能会报出如下错误:

    Strict Standards: Only variables should be passed by reference in E:ToolsECShop_V2.7.3_UTF8_release1106uploadincludescls_template.phpon line 418

    ###########################################

    ###                              解决方案同上                             ###

    ###########################################

原文地址:https://www.cnblogs.com/gosky/p/4869501.html