文档地址:https://github.com/zendframework/zend-http/tree/master/doc/book
1、get下载远程文件
- $url = '文件的地址';
- $rt = \Zend\Http\ClientStatic::get($url);
- if ($rt->isSuccess()) {
- $head = $rt->getHeaders()->toArray();
- $ext = substr(strrchr($head['Content-disposition'], '.'), 1, -1);
- $path = 'weixin/'.md5($url).'.'.$ext;
- file_put_contents(SYS_UPLOAD_PATH.$path, $rt->getContent());
- echo $path;
- }
文档最后更新时间:2016-12-06 20:55:10