当前位置: 首页>>代码示例>>PHP>>正文


PHP Chinese::ConvertIT方法代码示例

本文整理汇总了PHP中Chinese::ConvertIT方法的典型用法代码示例。如果您正苦于以下问题:PHP Chinese::ConvertIT方法的具体用法?PHP Chinese::ConvertIT怎么用?PHP Chinese::ConvertIT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Chinese的用法示例。


在下文中一共展示了Chinese::ConvertIT方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save_xml_file

function save_xml_file($filename, $xml_file)
{
    global $app_strings;
    $handle = fopen($filename, 'w');
    //fwrite($handle,iconv("GBK","UTF-8",$xml_file));
    if (!$handle) {
        return;
    }
    // Write $somecontent to our opened file.)
    if ($app_strings['LBL_CHARSET'] == "GBK") {
        if (function_exists('iconv')) {
            $xml_file = iconv_ec("GB2312", "UTF-8", $xml_file);
        } else {
            $chs = new Chinese("GBK", "UTF8", trim($xml_file));
            $xml_file = $chs->ConvertIT();
        }
        if (fwrite($handle, $xml_file) === FALSE) {
            return false;
        }
    } else {
        if ($app_strings['LBL_CHARSET'] != "UTF-8") {
            //$xml_file = iconv("ISO-8859-1","UTF-8",$xml_file);
            if (fwrite($handle, utf8_encode($xml_file)) === FALSE) {
                return false;
            }
        } else {
            if (fwrite($handle, $xml_file) === FALSE) {
                return false;
            }
        }
    }
    fclose($handle);
    return true;
}
开发者ID:honj51,项目名称:taobaocrm,代码行数:34,代码来源:Charts.php

示例2: iconv

 function iconv($s, $d, $string)
 {
     require_once ROOT_PATH . "inc/class.chinese.php";
     $cnvert = new Chinese("GB2312", "UTF8", $string, ROOT_PATH . "./inc/gbkcode/");
     $string = $cnvert->ConvertIT();
     return $string;
 }
开发者ID:GHubgenius,项目名称:qbbj,代码行数:7,代码来源:yeepay.php

示例3: change2pinyin

function change2pinyin($str, $type = '')
{
    $ret = "";
    if (WEB_LANG == 'utf-8') {
        if (function_exists('iconv')) {
            $str = iconv('UTF-8', 'GBK//IGNORE', $str);
        } else {
            require_once ROOT_PATH . "inc/class.chinese.php";
            $cnvert = new Chinese("UTF8", "GB2312", $str, ROOT_PATH . "./inc/gbkcode/");
            $str = $cnvert->ConvertIT();
        }
    } elseif (WEB_LANG == 'big5') {
        require_once ROOT_PATH . "inc/class.chinese.php";
        $cnvert = new Chinese("BIG5", "GB2312", $str, ROOT_PATH . "./inc/gbkcode/");
        $str = $cnvert->ConvertIT();
    }
    for ($i = 0; $i < strlen($str); $i++) {
        $p = ord(substr($str, $i, 1));
        if ($p > 160) {
            $q = ord(substr($str, ++$i, 1));
            $p = $p * 256 + $q - 65536;
        }
        $ret .= GetPinYin($p, $type);
    }
    return $ret;
}
开发者ID:GHubgenius,项目名称:qbbj,代码行数:26,代码来源:pinyin.php

示例4: smarty_outputfilter_langset

/**
 * Smarty trimwhitespace outputfilter plugin
 *
 * File:     outputfilter.trimwhitespace.php<br>
 * Type:     outputfilter<br>
 * Name:     trimwhitespace<br>
 * Date:     Jan 25, 2003<br>
 * Purpose:  trim leading white space and blank lines from
 *           template source after it gets interpreted, cleaning
 *           up code and saving bandwidth. Does not affect
 *           <<PRE>></PRE> and <SCRIPT></SCRIPT> blocks.<br>
 * Install:  Drop into the plugin directory, call
 *           <code>$smarty->load_filter('output','trimwhitespace');</code>
 *           from application.
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @author Contributions from Lars Noschinski <lars@usenet.noschinski.de>
 * @version  1.3
 * @param string
 * @param Smarty
 */
function smarty_outputfilter_langset($source, &$smarty)
{
    if ($_SESSION['langset'] == 'zh_tw') {
        //$source = iconv('UTF-8', 'GB2312'.'//TRANSLIT', $source);
        $source = iconv('UTF-8', 'GB2312' . '//IGNORE', $source);
        $objCnvert = new Chinese("GB2312", "BIG5", $source, __WEBCOMMON_ROOT . '/chinese/config/');
        $source = $objCnvert->ConvertIT();
        $source = iconv('BIG5', 'UTF-8' . '//IGNORE', $source);
    }
    return $source;
}
开发者ID:TiMoChao,项目名称:xingfu,代码行数:31,代码来源:outputfilter.langset.php

示例5: pinyin_slugs

function pinyin_slugs($slug)
{
    // We don't want to change an existing slug
    if ($slug) {
        return $slug;
    }
    global $wpdb;
    require "class.Chinese.php";
    $codeTablesDir = dirname(__FILE__) . "/config/";
    // Replace post title
    $title = $_POST['post_title'];
    $chs = new Chinese("UTF8", "GB2312", $title, $codeTablesDir);
    $title = $chs->ConvertIT();
    $chs = new Chinese("GB2312", "PinYin", $title, $codeTablesDir);
    $title = $chs->ConvertIT();
    $title = str_replace(" ", "", $title);
    return sanitize_title($title);
}
开发者ID:hjm8809,项目名称:xsphp.com,代码行数:18,代码来源:pinyin-slug.php

示例6: dirname

require_once dirname(__FILE__) . "/" . "global.php";
//header('Content-Type: text/html; charset=utf-8');
if ($fileData) {
    if (!$lfjid) {
        //showerr("你还没登录",1);
    }
    //其中..与/开头都是不允许的
    if (!ereg("^[0-9a-z_/]+\$", $dir) || ereg("^/", $dir)) {
        $dir = "other";
    }
    $updir = '';
    $path = "{$updir}/{$dir}";
    $array[name] = is_array($fileData) ? $_FILES[fileData][name] : $fileData_name;
    require_once ROOT_PATH . "inc/class.chinese.php";
    $cnvert = new Chinese("UTF8", "GB2312", $array[name], ROOT_PATH . "./inc/gbkcode/");
    $array[name] = $cnvert->ConvertIT();
    $array[path] = $webdb[updir] . "/" . $path;
    $array[size] = is_array($fileData) ? $_FILES[fileData][size] : $fileData_size;
    //$array[updateTable]=1;	//统计用户上传的文件占用空间大小
    $lfjuid = $userdb[uid];
    //处理上传的文件名标志
    $filename = upfile(is_array($fileData) ? $_FILES[fileData][tmp_name] : $fileData, $array);
    $newfile = "{$webdb['www_url']}/{$webdb['updir']}/{$dir}/{$filename}";
    //插入数据,关闭层
    echo '<html>';
    echo '<head>';
    echo '<title>Insert Image</title>';
    echo '<meta http-equiv="content-type" content="text/html; charset=gb2312">';
    echo '</head>';
    echo '<body>';
    if (!$_GET[Ctype]) {
开发者ID:GHubgenius,项目名称:qbbj,代码行数:31,代码来源:upfile_eweb.php

示例7: sendmail

 function sendmail($to, $from, $subject, $content, $T = 0)
 {
     global $webdb;
     //$name, $email, $subject, $content, $type=0
     $type = 1;
     //$name=array("{$webdb[webname]}会员");
     $email = array($to);
     $_CFG['smtp_host'] = $this->host;
     $_CFG['smtp_port'] = $this->port;
     $_CFG['smtp_user'] = $this->user;
     $_CFG['smtp_pass'] = $this->pass;
     $_CFG['name'] = $webdb[webname];
     $_CFG['smtp_mail'] = $from;
     if (WEB_LANG == 'big5') {
         require_once ROOT_PATH . "inc/class.chinese.php";
         $cnvert = new Chinese("BIG5", "GB2312", $subject, ROOT_PATH . "./inc/gbkcode/");
         $subject = $cnvert->ConvertIT();
         $cnvert = new Chinese("BIG5", "GB2312", $content, ROOT_PATH . "./inc/gbkcode/");
         $content = $cnvert->ConvertIT();
         //$cnvert = new Chinese("BIG5","GB2312",$name,ROOT_PATH."./inc/gbkcode/");
         //$name = $cnvert->ConvertIT();
         $cnvert = new Chinese("BIG5", "GB2312", $_CFG['name'], ROOT_PATH . "./inc/gbkcode/");
         $_CFG['name'] = $cnvert->ConvertIT();
     } elseif (WEB_LANG == 'utf-8') {
         require_once ROOT_PATH . "inc/class.chinese.php";
         $cnvert = new Chinese("UTF8", "GB2312", $subject, ROOT_PATH . "./inc/gbkcode/");
         $subject = $cnvert->ConvertIT();
         $cnvert = new Chinese("UTF8", "GB2312", $content, ROOT_PATH . "./inc/gbkcode/");
         $content = $cnvert->ConvertIT();
         //$cnvert = new Chinese("UTF8","GB2312",$name,ROOT_PATH."./inc/gbkcode/");
         //$name = $cnvert->ConvertIT();
         $cnvert = new Chinese("UTF8", "GB2312", $_CFG['name'], ROOT_PATH . "./inc/gbkcode/");
         $_CFG['name'] = $cnvert->ConvertIT();
     }
     //$name = "=?UTF-8?B?".base64_encode($name)."==?=";
     $subject = "=?gbk?B?" . base64_encode($subject) . "==?=";
     $content = base64_encode($content);
     $headers[] = "To:=?gbk?B?" . base64_encode($name[0]) . "?= <{$email['0']}>";
     $headers[] = "From:=?gbk?B?" . base64_encode($_CFG[name]) . "?= <{$_CFG['smtp_mail']}>";
     $headers[] = "MIME-Version: ";
     $headers[] = "X-Mailer: ";
     //$headers[] = "From:=?UTF-8?B?".base64_encode($_CFG['shop_name'])."==?=<$_CFG[smtp_mail]>";
     $headers[] = "Subject:{$subject}";
     $headers[] = $type == 0 ? "Content-Type: text/plain; charset=gbk; format=flowed" : "Content-Type: text/html; charset=gbk; format=flowed";
     $headers[] = "Content-Transfer-Encoding: base64";
     $headers[] = "Content-Disposition: inline";
     //    SMTP 服务器信息
     $params['host'] = $_CFG['smtp_host'];
     $params['port'] = $_CFG['smtp_port'];
     $params['user'] = $_CFG['smtp_user'];
     $params['pass'] = $_CFG['smtp_pass'];
     if (empty($params['host']) || empty($params['port'])) {
         // 如果没有设置主机和端口直接返回 false
         return false;
     } else {
         //  发送邮件
         $send_params['recipients'] = $email;
         $send_params['headers'] = $headers;
         $send_params['from'] = $_CFG['smtp_mail'];
         $send_params['body'] = $content;
         /*        
         echo "<pre>";
         print_r($params);
         print_r($send_params);
         echo "</pre>";
         exit;
         */
         $smtp = new qb_smtp($params);
         if ($smtp->connect() and $smtp->send($send_params)) {
             return TRUE;
         } else {
             return FALSE;
         }
         // end if
     }
 }
开发者ID:GHubgenius,项目名称:qbbj,代码行数:76,代码来源:class.mail.php

示例8: uniDecode

function uniDecode($str, $charcode)
{
    $text = preg_replace_callback("/%u[0-9A-Za-z]{4}/", toUtf8, $str);
    if (M_B == true) {
        return mb_convert_encoding($text, $charcode, 'utf-8');
    } else {
        if (ICONV == true) {
            return iconv("UTF-8", $charcode, $text);
        } else {
            include_once R_P . "chinese/class.Chinese.php";
            $codeTablesDir = R_P . "chinese/config/";
            $chs = new Chinese("UTF8", "GB2312", $text, $codeTablesDir);
            return $chs->ConvertIT();
        }
    }
}
开发者ID:holin,项目名称:sstour,代码行数:16,代码来源:all_fun.php

示例9: die

        if ($rs[uid] != $lfjuid) {
            $username = "匿名";
        }
    }
    $rss = $db->get_one(" SELECT * FROM {$_pre}content{$_erp} WHERE id='{$id}' ");
    if (!$rss) {
        die("原数据不存在");
    }
    $fid = $rss[fid];
    $username || ($username = $lfjid);
    if (WEB_LANG == 'big5') {
        require_once ROOT_PATH . "inc/class.chinese.php";
        $cnvert = new Chinese("GB2312", "BIG5", $content, ROOT_PATH . "./inc/gbkcode/");
        $content = $cnvert->ConvertIT();
        $cnvert = new Chinese("GB2312", "BIG5", $username, ROOT_PATH . "./inc/gbkcode/");
        $username = $cnvert->ConvertIT();
    }
    $db->query("INSERT INTO `{$_pre}comments` (`cuid`, `type`, `id`, `fid`, `uid`, `username`, `posttime`, `content`, `ip`, `icon`, `yz`) VALUES ('{$rss['uid']}','0','{$id}','{$fid}','{$lfjuid}','{$username}','{$timestamp}','{$content}','{$onlineip}','{$icon}','{$yz}')");
    $db->query(" UPDATE {$_pre}content{$_erp} SET comments=comments+1 WHERE id='{$id}' ");
} elseif ($action == "del") {
    $_erp = $Fid_db[tableid][$fid];
    $rs = $db->get_one("SELECT * FROM `{$_pre}comments` WHERE cid='{$cid}'");
    if (!$lfjuid) {
        die("你还没登录,无权限");
    } elseif (!$web_admin && $rs[uid] != $lfjuid && $rs[cuid] != $lfjuid) {
        die("你没权限");
    }
    //删除评论要扣除积分
    if (!$web_admin && $rs[uid] != $lfjuid && $webdb[DelOtherCommentMoney]) {
        $lfjdb[money] = get_money($lfjdb[uid]);
        if (abs($webdb[DelOtherCommentMoney]) > $lfjdb[money]) {
开发者ID:xubo245,项目名称:liuyangzhang,代码行数:31,代码来源:comment_ajax.php

示例10: dirname

<?php

require_once dirname(__FILE__) . "/" . "global.php";
header('Content-Type: text/html; charset=gb2312');
require_once ROOT_PATH . "inc/class.chinese.php";
$cnvert = new Chinese("UTF8", "GB2312", $_POST['queryString'], ROOT_PATH . "./inc/gbkcode/");
$_POST['queryString'] = $cnvert->ConvertIT();
$queryString = $_POST['queryString'];
if (strlen($queryString) > 0) {
    $query = $db->query("SELECT title FROM {$pre}article WHERE title LIKE '{$queryString}%' ORDER BY hits DESC LIMIT 10");
    while ($result = $db->fetch_array($query)) {
        echo '<li onClick="fill(\'' . $result[title] . '\');">' . $result[title] . '</li>';
    }
}
开发者ID:GHubgenius,项目名称:qbbj,代码行数:14,代码来源:s_rpc.php

示例11: Chinese

echo $string;
echo "GB->Big5 from URL html<br>";
$chs = new Chinese("GB2312", "BIG5", "", $codeTablesDir);
$chs->OpenFile("http://mail.21cn.com/jffs/help.html", true);
$string = $chs->ConvertIT();
//eregi("href[[:space:]]*=[[:space:]]*(.*)[[:space:]]", $ret, $ctemp);
//echo $ctemp;
//$string = "<a href=www.testing.com>testing</a>";
//echo $string;
$string = eregi_replace("href=\"", "href=\"http://mail.21cn.com/jffs/", $string);
//	$string = eregi_replace("member.php?action=reg", "http://omega.idv.tw/kdb120/member.php?action=reg", $string);
//echo eregi_replace("href[[:space:]]*=[[:space:]]*(^[^http]+)([^>]+)>", "\\2", $string);
//echo eregi("<a[[:space:]]+href[[:space:]]*=[[:space:]]*([^>]+)>([[:alnum:]]+)<[[:space:]]*/a[[:space:]]*>", $string, eregi_replace("\\1", "", "\\1"));
//if (substr($regexp[1], 0, 4) != "http") {
//	$string = eregi_replace($regexp[1], "http://omega.idv.tw/kdb120/".$regexp[1], $string);
//}
//print_r ($regexp);
//$string = "<a href=\"www.testing.com\">testing</a>";
//$string = eregi_replace("member.php", "http://omega.idv.tw/kdb120/member.php", $string);
echo $string;
echo "UTF8->Big5 base64<br>";
$r = base64_decode("6L+U5Zue6L2J5o+b5b6M55qE57WQ5p6c");
//echo $r;
$chs = new Chinese("UTF8", "BIG5", $r);
$string = $chs->ConvertIT();
echo $string;
echo "UTF8->GB base64<br>";
$r = base64_decode("5oiR5ZKM5L2g5LiA6LW355qELDEyMw==");
$chs = new Chinese("UTF8", "GB2312", trim($r));
echo $chs->ConvertIT();
开发者ID:holin,项目名称:sstour,代码行数:30,代码来源:Sample.php

示例12: ipfrom


//.........这里部分代码省略.........
            $DataSeek = implode('', unpack('L', $DataSeek . chr(0)));
            fseek($fd, $DataSeek);
            $ipData2 = fread($fd, 4);
            if (strlen($ipData2) < 4) {
                fclose($fd);
                return '- System Error';
            }
            $ip2num = implode('', unpack('L', $ipData2));
            if ($ip2num < 0) {
                $ip2num += pow(2, 32);
            }
            if ($ip2num < $ipNum) {
                if ($Middle == $BeginNum) {
                    fclose($fd);
                    return '- Unknown';
                }
                $BeginNum = $Middle;
            }
        }
        $ipFlag = fread($fd, 1);
        if ($ipFlag == chr(1)) {
            $ipSeek = fread($fd, 3);
            if (strlen($ipSeek) < 3) {
                fclose($fd);
                return '- System Error';
            }
            $ipSeek = implode('', unpack('L', $ipSeek . chr(0)));
            fseek($fd, $ipSeek);
            $ipFlag = fread($fd, 1);
        }
        if ($ipFlag == chr(2)) {
            $AddrSeek = fread($fd, 3);
            if (strlen($AddrSeek) < 3) {
                fclose($fd);
                return '- System Error';
            }
            $ipFlag = fread($fd, 1);
            if ($ipFlag == chr(2)) {
                $AddrSeek2 = fread($fd, 3);
                if (strlen($AddrSeek2) < 3) {
                    fclose($fd);
                    return '- System Error';
                }
                $AddrSeek2 = implode('', unpack('L', $AddrSeek2 . chr(0)));
                fseek($fd, $AddrSeek2);
            } else {
                fseek($fd, -1, SEEK_CUR);
            }
            while (($char = fread($fd, 1)) != chr(0)) {
                $ipAddr2 .= $char;
            }
            $AddrSeek = implode('', unpack('L', $AddrSeek . chr(0)));
            fseek($fd, $AddrSeek);
            while (($char = fread($fd, 1)) != chr(0)) {
                $ipAddr1 .= $char;
            }
        } else {
            fseek($fd, -1, SEEK_CUR);
            while (($char = fread($fd, 1)) != chr(0)) {
                $ipAddr1 .= $char;
            }
            $ipFlag = fread($fd, 1);
            if ($ipFlag == chr(2)) {
                $AddrSeek2 = fread($fd, 3);
                if (strlen($AddrSeek2) < 3) {
                    fclose($fd);
                    return '- System Error';
                }
                $AddrSeek2 = implode('', unpack('L', $AddrSeek2 . chr(0)));
                fseek($fd, $AddrSeek2);
            } else {
                fseek($fd, -1, SEEK_CUR);
            }
            while (($char = fread($fd, 1)) != chr(0)) {
                $ipAddr2 .= $char;
            }
        }
        fclose($fd);
        if (preg_match('/http/i', $ipAddr2)) {
            $ipAddr2 = '';
        }
        $ipaddr = "{$ipAddr1} {$ipAddr2}";
        $ipaddr = preg_replace('/CZ88\\.NET/is', '', $ipaddr);
        $ipaddr = preg_replace('/^\\s*/is', '', $ipaddr);
        $ipaddr = preg_replace('/\\s*$/is', '', $ipaddr);
        if (preg_match('/http/i', $ipaddr) || $ipaddr == '') {
            $ipaddr = '- Unknown';
        }
        if (WEB_LANG == 'big5') {
            require_once ROOT_PATH . "inc/class.chinese.php";
            $cnvert = new Chinese("GB2312", "BIG5", $ipaddr, ROOT_PATH . "./inc/gbkcode/");
            $ipaddr = $cnvert->ConvertIT();
        } elseif (WEB_LANG == 'utf-8') {
            require_once ROOT_PATH . "inc/class.chinese.php";
            $cnvert = new Chinese("GB2312", "UTF8", $ipaddr, ROOT_PATH . "./inc/gbkcode/");
            $ipaddr = $cnvert->ConvertIT();
        }
        return $ipaddr;
    }
}
开发者ID:xubo245,项目名称:liuyangzhang,代码行数:101,代码来源:function.inc.php

示例13: Chinese

<?php

// 码表所在目录。当class.Chinese.php与引用者不在同一目录下时,就应该对这个参数进行设置。
$codeTablesDir = "./config/";
include "class.Chinese.php";
/*
echo "UTF8->Big5 base64<br>";
$r = base64_decode("6L+U5Zue6L2J5o+b5b6M55qE57WQ5p6c");
//echo $r;
$chs = new Chinese("UTF8","BIG5",$r);
$string = $chs->ConvertIT();
echo $string;

echo "UTF8->GB base64<br>";
$r = base64_decode("5oiR5ZKM5L2g5LiA6LW355qELDEyMw==");
$chs = new Chinese("UTF8","GB2312", trim($r) );
echo $chs->ConvertIT();
*/
$cnvert = new Chinese("GB2312", "UTF8", "WEB2.0");
echo $cnvert->ConvertIT() . "<br />";
开发者ID:holin,项目名称:sstour,代码行数:20,代码来源:Sample_temp.php

示例14: _gb2312ToUNICODE

 /**
  * GB2312转UNICODE
  *
  * @param string $pString 原始字串
  *
  * @return string
  */
 private function _gb2312ToUNICODE($pString)
 {
     if (!empty($pString)) {
         $chs = new Chinese("GB2312", "UNICODE", $pString);
         $string = $chs->ConvertIT();
         return preg_replace("/&#x([0-9A-F]{4});/", "%u\$1", $string);
     }
     return "";
 }
开发者ID:iwater,项目名称:kissphp,代码行数:16,代码来源:Chart.php

示例15: convert

 public function convert($text)
 {
     $this->setSourceText($text);
     return parent::ConvertIT();
 }
开发者ID:robhagemans,项目名称:yii-chinese,代码行数:5,代码来源:JChinese.php


注:本文中的Chinese::ConvertIT方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。