Why does this error occur when the local ecshop website is uploaded to the Internet? Strict Standards: Only variables shocould be passed by reference in lib_main.php on line 2661 local php is 5.2
The first row of this file is $ ext = end (explode ('.', $ tmp ));
$ Tmp = basename ($ tmp, ". $ ext"); what are the possible causes?
Reply to discussion (solution)
Strict Standards: Only variables shocould be passed by reference
Strict standard: only variables can be used here
$ Ext = end (explode ('.', $ tmp ));
Ying writing
$ T = $ ext = explode ('.', $ tmp );
$ Ext = end ($ t );
This is an error check that is available only after php 5.4.
In fact, php already provides more concise functions.
$ Ext = pathinfo ($ tmp, PATHINFO_EXTENSION );
The end parameter must be of the reference type and the reference type must be of the left value, as shown below:
Mixed end (array & $ array)
The function explode returns the right value and cannot be referenced.
Mixed end (array & $ array)
The end parameter is of the reference type.
An error occurs because explode does not return a variable.
In fact, you can change it.
$ext = substr($tmp, strrpos($tmp,'.')+1);
Or
$ext = explode('.', $tmp);$ext = array_pop($ext);echo $ext;
This is only caused by the error check level.
This is not because the end function cannot accept the return value of the function.
Echo phpversion (), PHP_EOL; // Print the php code $ tmp = 'AAA. ext '; $ ext = @ end (explode ('. ', $ tmp); // block the error message echo $ ext; // output ext
Thank you for your enthusiastic answers.