[英]Strict Standards: Only variables should be passed by reference PHP Shopping Cart
i'm currently in the process of creating a PHP shopping cart but keep i'm stuck with the error "Strict Standards: Only variables should be passed by reference PHP Shopping Cart". 我目前正在创建一个PHP购物车,但请注意错误“严格标准:参考PHP购物车只能传递变量”。 I've researched the error, found many different explanations as to why this is happening.
我研究了该错误,并找到了许多关于这种情况发生原因的不同解释。 I can't seem to resolve the issue.
我似乎无法解决问题。 Any help would be much appreciated.
任何帮助将非常感激。 Please see my code below.
请在下面查看我的代码。
$img=mysql_real_escape_string(end(explode('/',$_POST['img'])));
You need to break up your code instead of doing it all at once, like so: 您需要分解代码而不是一次完成所有操作,如下所示:
$imgArr = explode('/',$_POST['img']);
$img = end($imgArr);
$imgEscaped = mysql_real_escape_string($img);
The reason why is that end() expects a variable to be passed by reference, and so you need to assign your explode() to an intermediate variable first. 原因是end()期望变量通过引用传递,因此您需要首先将explode()分配给中间变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.