Only variables should be passed by reference

后端 未结 12 1454
囚心锁ツ
囚心锁ツ 2020-11-22 06:14
// Other variables
$MAX_FILENAME_LENGTH = 260;
$file_name = $_FILES[$upload_name][\'name\'];
//echo \"testing-\".$file_name.\"
\"; //$file_name = strtolower
12条回答
  •  礼貌的吻别
    2020-11-22 06:27

    Try this:

    $parts = explode('.', $file_name);
    $file_extension = end($parts);
    

    The reason is that the argument for end is passed by reference, since end modifies the array by advancing its internal pointer to the final element. If you're not passing a variable in, there's nothing for a reference to point to.

    See end in the PHP manual for more info.

提交回复
热议问题