douba4824
douba4824
2016-03-28 10:25

如何在变量中存储var_dump数据

I have the following var_dump data in my console. i want to store them in variables.

    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)
  }
}

UPDATE

My code

    $variable =   var_dump($_FILES);
    echo $variable;
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • dsxrq28228 dsxrq28228 5年前

    As you said :- I want to store "name", "type" and "tmp_name" in variables

    And you tell that your variable is $_FILES. So do like below:-

    $name  = $_FILES['pupload']['name']; 
    $type  = $_FILES['pupload']['type']; 
    $tmp_name = $_FILES['pupload']['tmp_name']; 
    echo $name.' : '.$type.' : '.$tmp_name;
    
    点赞 评论 复制链接分享
  • dqjmq28248 dqjmq28248 5年前

    This can do

    function var_dump_ret($mixed = null) {
     ob_start();
     var_dump($mixed);
     $content = ob_get_contents();
     ob_end_clean();
     return $content;
    }
    
    点赞 评论 复制链接分享

为你推荐