我的控制台中有以下var_dump
数据。我想将它们存储在变量中。
array(1) {
["pupload"]=>
array(5) {
["name"]=>
string(11) "profile.jpg"
["type"]=>
string(10) "image/jpeg"
["tmp_name"]=>
string(45) "C:\Users\pcname\AppData\Local\Temp\phpAF1C.tmp"
["error"]=>
int(0)
["size"]=>
int(114348)
}
}
更新
我的代码
$variable = var_dump($_FILES);
echo $variable;
答案 0 :(得分:1)
正如您所说: - I want to store "name", "type" and "tmp_name" in variables
你告诉你的变量是$_FILES
。如下所示: -
$name = $_FILES['pupload']['name'];
$type = $_FILES['pupload']['type'];
$tmp_name = $_FILES['pupload']['tmp_name'];
echo $name.' : '.$type.' : '.$tmp_name;
答案 1 :(得分:0)
这可以做到
function var_dump_ret($mixed = null) {
ob_start();
var_dump($mixed);
$content = ob_get_contents();
ob_end_clean();
return $content;
}