日期:2014-05-17  浏览次数:20459 次

帮看一下,在中文名和有空格的文件名的不能下载,另外重命名要是中文是乱码
本帖最后由 lfcyk 于 2013-01-22 22:41:49 编辑
<?php
    /**
     * 下载远程文件类支持断点续传
     */
    class HttpDownload {
        private $m_url = "";
        private $m_urlpath = "";
        private $m_scheme = "http";
        private $m_host = "";
        private $m_port = "80";
        private $m_user = "";
        private $m_pass = "";
        private $m_path = "/";
        private $m_query = "";
        private $m_fp = "";
        private $m_error = "";
        private $m_httphead = "" ;
        private $m_html = "";
      
        /**
         * 初始化
         */
        public function PrivateInit($url){
            $urls = "";
            $urls = @parse_url($url);
            $this->m_url = $url;
            if(is_array($urls)) {
                $this->m_host = $urls["host"];
                if(!empty($urls["scheme"])) $this->m_scheme = $urls["scheme"];
                if(!empty($urls["user"])) $this->m_user = $urls["user"];
                if(!empty($urls["pass"])) $this->m_pass = $urls["pass"];
                if(!empty($urls["port"])) $this->m_port = $urls["port"];
                if(!empty($urls["path"])) $this->m_path = $urls["path"];
                $this->m_urlpath = $this->m_path;
                if(!empty($urls["query"])) {
                    $this->m_query = $urls["query"];
                    $this->m_urlpath .= "?".$this->m_query;
   &nb