ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
* [ ] 获取上传文件 ``` Request::file($Key = null, $Default = null); ``` Key(string):字段名称 Default (null|string....):默认内容 ***** 获取整个上传文件数组 ``` Request::file(); ``` 返回的文件格式类似: ``` array ( 'avatar' => array ( 'name' => '123.jpg', 'tmp_name' => '/tmp/workerman.upload.9hjR4w', 'size' => 1196127, 'error' => 0, 'type' => 'application/octet-stream', ), 'anotherfile' => array ( 'name' => '456.txt', 'tmp_name' => '/tmp/workerman.upload.9sirSws', 'size' => 490, 'error' => 0, 'type' => 'text/plain', ) ) ``` 其中: * name为文件名字 * tmp\_name为磁盘临时文件位置 * size为文件大小 * error为[错误码](https://www.php.net/manual/zh/features.file-upload.errors.php) * type为文件mine类型。 ***** 获取特定上传文件 ``` Request::file('avatar'); ``` 返回类似 ``` array ( 'name' => '123.jpg', 'tmp_name' => '/tmp/workerman.upload.9hjR4w', 'size' => 1196127, 'error' => 0, 'type' => 'application/octet-stream', ) ```