thinkphp5.1 获取上传文件内容file

$file   = $request->file('file');
object(think\File)#104 (13) {
  ["error":"think\File":private]=>
  string(0) ""
  ["filename":protected]=>
  string(24) "C:\xampp\tmp\php81C6.tmp"
  ["saveName":protected]=>
  NULL
  ["rule":protected]=>
  string(4) "date"
  ["validate":protected]=>
  array(0) {
  }
  ["isTest":protected]=>
  NULL
  ["info":protected]=>
  array(5) {
    ["name"]=>
    string(10) "鏂囨。.pdf"
    ["type"]=>
    string(15) "application/pdf"
    ["tmp_name"]=>
    string(24) "C:\xampp\tmp\php81C6.tmp"
    ["error"]=>
    int(0)
    ["size"]=>
    int(57778)
  }
  ["hash":protected]=>
  array(0) {
  }
  ["pathName":"SplFileInfo":private]=>
  string(24) "C:\xampp\tmp\php81C6.tmp"
  ["fileName":"SplFileInfo":private]=>
  string(11) "php81C6.tmp"
  ["openMode":"SplFileObject":private]=>
  string(1) "r"
  ["delimiter":"SplFileObject":private]=>
  string(1) ","
  ["enclosure":"SplFileObject":private]=>
  string(1) """
}
var_dump($file->getInfo());die;

 

array(5) {
  ["name"]=>
  string(10) "鏂囨。.pdf"
  ["type"]=>
  string(15) "application/pdf"
  ["tmp_name"]=>
  string(24) "C:\xampp\tmp\php418D.tmp"
  ["error"]=>
  int(0)
  ["size"]=>
  int(57778)
}

 

 

 

 

 

你可能感兴趣的:(php,thinkphp5)