首先上代码
// 导入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"
只是文件名称
我想得到这个文件的路径如下图

ORZ谁来教教我
立即学习“PHP免费学习笔记(深入)”;
回复内容:
$upload->savePath 或 $upload->rootPath

以上就是thinkphp3.2.3 上传文件如何获取路径的内容,更多相关内容请关注PHP中文网(www.php.cn)!
相关文章:
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号