一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

最好的邮件编码解码类,再没有比这个好的了!贴不下了(1)

时间:2022-07-02 10:34:11 编辑:袖梨 来源:一聚教程网

class mime_decode {
    var $content     = Array();
    function mime_encode_headers($string) {
        if($string == "") return;
        if(!eregi("^([[:print:]]*)$",$string))
       $string = "=?ISO-8859-1?Q?".str_replace("+","_",str_replace("%","=",urlencode($string)))."?=";
        return $string;
    }
    function decode_mime_string($string) {
        if(($pos = strpos($string,"=?")) === false) return $string;
        while(!($pos === false)) {
       $newresult .= substr($string,0,$pos);
       $string = substr($string,$pos+2,strlen($string));
       $intpos = strpos($string,"?");
       $charset = substr($string,0,$intpos);
       $enctype = strtolower(substr($string,$intpos+1,1));
       $string = substr($string,$intpos+3,strlen($string));
       $endpos = strpos($string,"?=");
       $mystring = substr($string,0,$endpos);
       $string = substr($string,$endpos+2,strlen($string));
       if($enctype == "q") {
           $mystring = str_replace("_"," ",$mystring);
           $mystring = $this->decode_qp($mystring);

热门栏目