php中$_FILES是什么意思
本教程操作环境:windows7系统、php7.1版、DELL G3电脑
在php中,“$_FILES”是一个预定义的数组变量。
$_FILES
可获取通过 POST 方式上传到服务器的文件数据;
如果为单个文件上传,那么 $_FILES 为二维数组;如果为多个文件上传,那么 $_FILES 为三维数组。
示例:
建立一个 file.html 演示上传文件,其中的代码如下:
<html> <head></head> <body></body> <form enctype="multipart/form-data" action="file.php" method="POST"> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> </html>
新建一个用于接收文件信息的 PHP 文件 file.php,代码如下:
<?php echo "<pre>"; print_r($_FILES); ?>
在 file.html 页面选择文件后,单击 Send File 按钮,将会在页面输出以下信息:
Array ( [userfile] => Array ( [name] => Screen Shot 2016-05-12 at 18.13.24.png [type] => image/png [tmp_name] => /private/var/tmp/phplVHp3W [error] => 0 [size] => 344925 ) )
版权声明:
作者:后浪云
链接:https://www.idc.net/help/8088/
文章版权归作者所有,未经允许请勿转载。
THE END