文档地址:https://github.com/zendframework/zend-http/tree/master/doc/book

    1、get下载远程文件

    1. $url = '文件的地址';
    2.  
    3. $rt = \Zend\Http\ClientStatic::get($url);
    4. if ($rt->isSuccess()) {
    5. $head = $rt->getHeaders()->toArray();
    6. $ext = substr(strrchr($head['Content-disposition'], '.'), 1, -1);
    7. $path = 'weixin/'.md5($url).'.'.$ext;
    8. file_put_contents(SYS_UPLOAD_PATH.$path, $rt->getContent());
    9. echo $path;
    10. }

    文档最后更新时间:2016-12-06 20:55:10