網站首頁 Thinkphp 正文
打印一下上傳的文件對象可以的得出,大致對象結構如下
object(think\File)#91 (13) {
["error":"think\File":private] => string(0) ""
["filename":protected] => string(14) "/tmp/phpYohoFK"
["saveName":protected] => NULL
["rule":protected] => string(4) "date"
["validate":protected] => array(0) {
}
["isTest":protected] => NULL
["info":protected] => array(5) {
["name"] => string(24) "11_190523173145_1-lp.jpg"
["type"] => string(10) "image/jpeg"
["tmp_name"] => string(14) "/tmp/phpYohoFK"
["error"] => int(0)
["size"] => int(10841)
}
["hash":protected] => array(0) {
}
["pathName":"SplFileInfo":private] => string(14) "/tmp/phpYohoFK"
["fileName":"SplFileInfo":private] => string(9) "phpYohoFK"
["openMode":"SplFileObject":private] => string(1) "r"
["delimiter":"SplFileObject":private] => string(1) ","
["enclosure":"SplFileObject":private] => string(1) """
}
看這結構,訪問權限是protected,如何獲取呢?
獲取方法:
對象->getInfo() 獲取info屬性
代碼示例
$file_info = request()->file('file');
$file_name = $file_info->getInfo()['name'];
相關推薦
- 2022-07-29 Linux中Vi和Vim編輯器用法詳解_linux shell
- 2022-09-21 Python?Ast抽象語法樹的介紹及應用詳解_python
- 2023-01-21 C#實現Word轉換RTF的示例代碼_C#教程
- 2022-10-26 Flutter?EventBus事件總線的應用詳解_Android
- 2022-06-30 Unity多屏幕設置的具體方案_C#教程
- 2023-10-12 可選鏈操作符(?.)及其使用方法與場景
- 2022-05-06 docker?save與docker?export的區別_docker
- 2022-08-01 Python實現數字圖像處理染色體計數示例_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支