【发布时间】:2021-08-02 12:44:30
【问题描述】:
为什么 unset 函数在上传文件后不删除 $_FILES 内容或清空它。 上传文件后如何清空我的 $FILES 变量。
<html>
<head>
<title>Files Upload</title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="pdf" id="pdf"><br>
<input type="submit" name="sumbit" value="upload">
</form>
</body>
</html>
<?php
unset($GLOBALS['$_FILES']);
echo "<pre>";
var_dump($_FILES);
echo "</pre>";
?>
The Output is :
array(1) {
["pdf"]=>
array(5) {
["name"]=>
string(19) "Courses Degrees.pdf"
["type"]=>
string(15) "application/pdf"
["tmp_name"]=>
string(24) "C:\xampp\tmp\php6BBD.tmp"
["error"]=>
int(0)
["size"]=>
int(624129)
}
}
【问题讨论】:
-
如果你
var_dump($GLOBALS);,你会看到文件在_FILES,而不是$FILES -
您的编辑在 _FILES 上仍有美元符号
-
这些我都试过了
-
你试过
$_GLOBALS['_FILES']?嗯
标签: php file superglobals