简体   繁体   English

严格的标准:只能通过引用传递变量PHP购物车

[英]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.

相关问题 烦人的PHP错误:“严格的标准:只有变量应该通过引用传递” - Annoying PHP error: “Strict Standards: Only variables should be passed by reference in” 严格标准:只应在functions.php中通过引用传递变量 - Strict Standards: Only variables should be passed by reference in functions.php PHP严格标准:在wordpress函数中,只能通过引用传递变量 - PHP Strict Standards: Only variables should be passed by reference in on wordpress function 严格标准:只应通过引用传递变量 - php错误 - Strict Standards: Only variables should be passed by reference - php error PHP 严格标准:在 .lib 中只应通过引用传递变量 - PHP Strict Standards: Only variables should be passed by reference in .lib PHP严格标准:只有变量应通过引用传递给 - PHP Strict Standards: Only variables should be passed by reference in 面向PHP对象的“严格标准:仅变量应通过引用传递给” - PHP Object Oriented “Strict standards: Only variables should be passed by reference in” 严格标准:只有变量应通过引用传递给 - Strict Standards: Only variables should be passed by reference in 严格的标准:只有变量应该通过引用传递 - Strict Standards: Only variables should be passed by reference 严格标准:仅变量应通过引用传递 - Strict Standards: Only variables should be passed by reference
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM