格式转换


  public function setUTF8($str){

        $encode = mb_detect_encoding($str, array("ASCII","utf-8","GB2312","GBK","BIG5"));
        if ($encode == "GBK"){
            $str = mb_convert_encoding($str, "utf-8", "GBK");
            $this->_up_code = true;
            $this->_char_code = 'GBK';
        }
        if ($encode == "GB2312" || $encode == 'EUC-CN'){
            $str = mb_convert_encoding($str, "utf-8", "GB2312");
            $this->_char_code = 'GB2312';
            $this->_up_code = true;
        }
        if ($encode == 'ASCII'){
            $str = urldecode($str);
        }

        return $str;
    }

《“格式转换”》 有 1 条评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注