相关疑难解决方法(0)

只应通过引用传递变量

// Other variables
$MAX_FILENAME_LENGTH = 260;
$file_name = $_FILES[$upload_name]['name'];
//echo "testing-".$file_name."<br>";
//$file_name = strtolower($file_name);
$file_extension = end(explode('.', $file_name)); //ERROR ON THIS LINE
$uploadErrors = array(
    0=>'There is no error, the file uploaded with success',
    1=>'The uploaded file exceeds the upload max filesize allowed.',
    2=>'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
    3=>'The uploaded file was only partially uploaded',
    4=>'No file was uploaded',
    6=>'Missing a temporary folder'
);
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?2天后仍然卡住了.

php

220
推荐指数
9
解决办法
23万
查看次数

严格标准:只应通过引用传递变量

$el = array_shift($instance->find(..))
Run Code Online (Sandbox Code Playgroud)

上面的代码以某种方式报告了严格的标准警告,但这不会:

function get_arr(){
    return array(1,2);
}
$el = array_shift(get_arr());
Run Code Online (Sandbox Code Playgroud)

那么它什么时候会报告警告呢?

php reference strict

81
推荐指数
3
解决办法
16万
查看次数

查找上传文件的扩展名(PHP)

可能重复:
在PHP中获取上传文件扩展名的最佳方法/做法是什么

我们可以从$ _FILES ["file"] ["tmp_name"]中找出原始文件的扩展名吗?例如jpg或png等?谢谢.

php

42
推荐指数
2
解决办法
9万
查看次数

在PHP中获取上传文件扩展名的最佳方法/实践是什么?

我有一个允许用户上传文件的表单,但我需要获取文件扩展名,我能够获得,但不确定我是否使用最有效的解决方案

我可以通过以下方式获得它

$fileInfo = pathinfo($_FILES['File']['name']);
echo $fileInfo['extension'];

$ext = end(explode('.',$_FILES['File']['name']));
echo $ext;
Run Code Online (Sandbox Code Playgroud)

哪种方法最好使用,或者是否有更好的解决方案可以获得扩展?

php

5
推荐指数
1
解决办法
2861
查看次数

标签 统计

php ×4

reference ×1

strict ×1