Heim  >  Artikel  >  Backend-Entwicklung  >  如何获取thinkphp3.2.3 上传文件路径

如何获取thinkphp3.2.3 上传文件路径

PHP中文网
PHP中文网Original
2017-03-24 15:27:443752Durchsuche

thinkphp3.2.3 上传文件如何获取路径:

首先上代码

//  导入excel
     public function upload(){       $upload = new \Think\Upload();// 实例化上传类
       $upload->maxSize   =     3145728 ;// 设置附件上传大小
       $upload->exts      =     array('xlsx','xls');// 设置附件上传类型
       $upload->rootPath  =      './Uploads/'; // 设置附件上传根目录
       $upload->savePath  =      ''; // 设置附件上传(子)目录
       // 上传文件
       $info   =   $upload->upload();       if(!$info) {// 上传错误提示错误信息
           $this->error($upload->getError());
       }else{// 上传成功 获取上传文件信息
           foreach($info as $file){               $FilePath = $file['savePath'].$file['savename'];
           }
           dump($FilePath);
       }
     }

页面输出内容
string(17) "57a9841cc3208.xls"
只是文件名称

我想得到这个文件的路径如下图

1008.png

ORZ谁来教教我

回复内容:

$upload->savePath 或 $upload->rootPath

1009.png

以上就是thinkphp3.2.3 上传文件如何获取路径的内容,更多相关内容请关注PHP中文网(www.php.cn)!

相关文章:

如何获取thinkphp3.2.3 上传文件路径

Thinkphp3.2.3整合phpqrcode生成二维码的示例代码分享

PHP 实现页面无刷新上传文件

使用Html5实现异步上传文件,支持跨域,带有上传进度条

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn