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


PHP Chinese类代码示例

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


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

示例1: 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

示例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: 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

示例4: get_payment_code

 public function get_payment_code($payment_notice_id)
 {
     $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
     //$order = $GLOBALS['db']->getRow("select order_sn,bank_id from ".DB_PREFIX."deal_order where id = ".$payment_notice['order_id']);
     $order_sn = $payment_notice['notice_sn'];
     $money = round($payment_notice['money'], 2);
     $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
     $payment_info['config'] = unserialize($payment_info['config']);
     /*$data_front_url =  SITE_DOMAIN.APP_ROOT.'/index.php?ctl=payment&act=notify&class_name=Guofubao';
       $data_front_url="";
       $data_return_url = SITE_DOMAIN.APP_ROOT.'/index.php?ctl=payment&act=response&class_name=Guofubao';
       */
     //新
     $data_front_url = SITE_DOMAIN . APP_ROOT . '/callback/pay/guofubao_callback.php?act=notify';
     //$data_front_url="";
     $data_return_url = SITE_DOMAIN . APP_ROOT . '/callback/pay/guofubao_callback.php?act=response';
     $tranCode = '8888';
     //$spbill_create_ip = $_SERVER['REMOTE_ADDR'];
     $spbill_create_ip = CLIENT_IP;
     /* 交易日期 */
     $today = to_date($payment_notice['create_time'], 'YmdHis');
     $bank_id = $payment_notice['bank_id'];
     if ($bank_id == '0') {
         $bank_id = '';
     }
     $desc = $order_sn;
     include_once APP_ROOT_PATH . "system/libs/iconv.php";
     $chinese = new Chinese();
     $desc = $chinese->Convert("UTF-8", "GBK", $desc);
     /* 货币类型 */
     $currencyType = '156';
     /* 数字签名 */
     $version = '2.1';
     $tranCode = $tranCode;
     $merchant_id = $payment_info['config']['merchant_id'];
     $merOrderNum = $order_sn;
     $tranAmt = $money;
     // 总金额
     $feeAmt = '';
     $tranDateTime = $today;
     $frontMerUrl = $data_front_url;
     $backgroundMerUrl = $data_return_url;
     //返回的路径
     $tranIP = $spbill_create_ip != "" ? $spbill_create_ip : '';
     //商户识别码
     $verficationCode = $payment_info['config']['VerficationCode'];
     $gopayServerTime = trim(file_get_contents("https://www.gopay.com.cn/PGServer/time"));
     $signValue = 'version=[' . $version . ']tranCode=[' . $tranCode . ']merchantID=[' . $merchant_id . ']merOrderNum=[' . $merOrderNum . ']tranAmt=[' . $tranAmt . ']feeAmt=[' . $feeAmt . ']tranDateTime=[' . $tranDateTime . ']frontMerUrl=[' . $frontMerUrl . ']backgroundMerUrl=[' . $backgroundMerUrl . ']orderId=[]gopayOutOrderId=[]tranIP=[' . $tranIP . ']respCode=[]gopayServerTime=[' . $gopayServerTime . ']VerficationCode=[' . $verficationCode . ']';
     $signValue = md5($signValue);
     /*交易参数*/
     $parameter = array('version' => '2.1', 'charset' => '2', 'language' => '1', 'signType' => '1', 'tranCode' => '8888', 'merchantID' => $merchant_id, 'virCardNoIn' => $payment_info['config']['virCardNoIn'], 'merOrderNum' => $merOrderNum, 'tranAmt' => $tranAmt, 'currencyType' => $currencyType, 'tranDateTime' => $tranDateTime, 'tranIP' => $spbill_create_ip, 'goodsName' => $desc, 'goodsDetail' => '', 'buyerName' => '', 'buyerContact' => '', 'frontMerUrl' => $frontMerUrl, 'backgroundMerUrl' => $backgroundMerUrl, 'signValue' => $signValue, 'gopayServerTime' => $gopayServerTime, 'bankCode' => $bank_id, 'userType' => 1, 'feeAmt' => '', 'isRepeatSubmit' => '', 'merRemark1' => $payment_notice_id, 'merRemark2' => '');
     $def_url = '<form style="text-align:center;" action="https://gateway.gopay.com.cn/Trans/WebClientAction.do" target="_blank" style="margin:0px;padding:0px" method="get" >';
     foreach ($parameter as $key => $val) {
         $def_url .= "<input type='hidden' name='{$key}' value='{$val}' />";
     }
     $def_url .= "<input type='submit' class='paybutton' value='前往国付宝在线支付' />";
     $def_url .= "</form>";
     $def_url .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</div>";
     return $def_url;
 }
开发者ID:eliu03,项目名称:fanweP2P,代码行数:60,代码来源:Guofubao_payment.php

示例5: _iconv

function _iconv($s, $t, $data)
{
    if (function_exists('iconv')) {
        return iconv($s, $t, $data);
    } else {
        require_once 'chinese.class.php';
        $chs = new Chinese($s, $t);
        return $chs->convert($data);
    }
}
开发者ID:Harvey,项目名称:www.nextim.cn,代码行数:10,代码来源:common.php

示例6: 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

示例7: webim_from_utf8

function webim_from_utf8($charset, $str)
{
    if (strtoupper($charset) == 'UTF-8') {
        return $str;
    }
    if (function_exists('iconv')) {
        return iconv('utf-8', $charset, $str);
    }
    require_once dirname(__FILE__) . '/class_chinese.php';
    $chs = new Chinese('utf-8', $charset);
    return $chs->Convert($str);
}
开发者ID:nextalk,项目名称:webim-for-php4,代码行数:12,代码来源:webim_common.func.php

示例8: jsprocdata

function jsprocdata($data, $requestcharset)
{
    global $boardurl, $_DCACHE, $charset;
    if ($requestcharset) {
        include DISCUZ_ROOT . 'include/chinese.class.php';
        if (strtoupper($charset) != 'UTF-8') {
            $c = new Chinese($charset, 'utf8');
        } else {
            $c = new Chinese('utf8', $requestcharset == 1 ? 'gbk' : 'big5');
        }
        $data = $c->Convert($data);
    }
    return 'document.write(\'' . preg_replace("/\r\n|\n|\r/", '\\n', addcslashes($data, "'\\")) . '\');';
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:14,代码来源:javascript.php

示例9: big52utf8

 public function big52utf8($string)
 {
     $string = mb_convert_encoding($string, "UTF-8", "BIG5");
     $string = Chinese::decimal_notation_converting($string);
     $string = $this->stringRevise($string);
     return $string;
 }
开发者ID:bunkeraa,项目名称:laravel,代码行数:7,代码来源:lib.php

示例10: wap_footer

function wap_footer()
{
    global $wind_version, $db_obstart, $windid, $db_charset, $db_wapcharset, $prog, $chs;
    require_once PrintEot('wap_footer');
    $output = ob_get_contents();
    ob_end_clean();
    $db_obstart && function_exists('ob_gzhandler') ? ob_start('ob_gzhandler') : ob_start();
    if ($db_charset != 'utf8') {
        $chs = new Chinese();
        $output = $chs->Convert($output, $db_charset, $db_wapcharset ? 'UTF8' : 'UNICODE');
    }
    $output = str_replace(array('<!--<!---->', '<!---->'), '', $output);
    echo $output;
    flush();
    exit;
}
开发者ID:adi00,项目名称:wumaproject,代码行数:16,代码来源:wap_mod.php

示例11: get_seo_info

function get_seo_info($domain, $che)
{
    global $ROBOT;
    $che = explode(',', $che);
    $ch = array_combine($che, $che);
    $content = '';
    $site_info = '';
    $link_info = '';
    $jobs = array();
    $jobs[1] = "baidu";
    $jobs[2] = "google";
    $jobs[3] = "yahoo";
    $jobs[4] = "soso";
    $jobs[5] = "vnet";
    $jobs[6] = "so163";
    $jobs[7] = "sogou";
    $a = '<table border=1 width=100% bordercolordark=#FFFFFF cellspacing=0 cellpadding=0 bordercolorlight=#BBD7E6>	<tr bgcolor=#D8F0FC><td colspan=9>网址<a href=http://' . $domain . ' target=_blank>http://' . $domain . '</a>在各大搜索引擎的收录查询结果</td></tr><tr><td>搜索引擎</td>';
    for ($i = 1; $i <= sizeof($jobs); $i++) {
        if ($ch[$i]) {
            $a .= "<td>" . $ROBOT[$jobs[$i]]['name'] . "</td>";
        }
    }
    $a .= "</tr><tr><td>收录数量</td>";
    for ($i = 1; $i <= sizeof($jobs); $i++) {
        if ($ch[$i]) {
            eval('$__file__=__FILE__;');
            define('ROOT_PATH', $__file__ ? dirname($__file__) . '/' : './');
            $content[$i] = get_content($ROBOT[$jobs[$i]]['site_url'] . $domain);
            if ($i == 3 || $i == 5 || $i == 6) {
                require_once 'require/chinese.php';
                $chs = new Chinese('utf-8', 'GB2312');
                $content[$i] = $chs->Convert($content[$i]);
            }
            if (empty($content[$i])) {
                return 'Unkown Error...';
            }
            if (preg_match($ROBOT[$jobs[$i]]['site_pattern'], $content[$i], $matches[$i])) {
                $site_info[$i] = $matches[$i][1];
            }
            $site_info[$i] = $site_info[$i] ? $site_info[$i] : '--';
            $a .= '<td><a href="' . $ROBOT[$jobs[$i]]['site_url'] . $domain . '" target="_blank">' . $site_info[$i] . '</a></td>';
        }
    }
    $a .= "</tr><tr><td>相关查询</td><td colspan=7 align=left><a href=../ip/index.php?domain=" . $domain . " target=_blank>IP地址查询</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=../pr/pr.php?domain=" . $domain . " target=_blank>PR查询</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=../whois/index.php?domain=" . $domain . " target=_blank>域名Whois查询</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=/alexa target=_blank>Alexa排名查询</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=../friends/friends.php?domain=" . $domain . " target=_blank>友情链接查询</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=../friendlink/friendlink.php?domain=" . $domain . " target=_blank>友情链接IP查询</a></td></tr></table>";
    return $a;
}
开发者ID:repodevs,项目名称:web_admin_tools,代码行数:46,代码来源:function.php

示例12: 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

示例13: insenz_convert

function insenz_convert($str, $type = 1)
{
    global $charset, $discuz_chs, $insenz_chs;
    if ($charset != 'utf-8') {
        require_once DISCUZ_ROOT . './include/chinese.class.php';
        if ($type) {
            if (!$insenz_chs) {
                $insenz_chs = new Chinese($charset, 'utf-8', TRUE);
            }
            $str = $insenz_chs->convert($str);
        } else {
            if (!$discuz_chs) {
                $discuz_chs = new Chinese('utf-8', $charset, TRUE);
            }
            $str = $discuz_chs->convert($str);
        }
    }
    return $type ? htmlspecialchars($str) : addslashes($str);
}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:19,代码来源:insenz.func.php

示例14: _buildResult

 function _buildResult($result, $index)
 {
     require_once R_P . 'm/chinese.php';
     $chs = new Chinese('utf8', 'gbk');
     foreach ($result["words"] as $word => $info) {
         $words[] = $chs->Convert($word);
     }
     $totals = $result['total'];
     if (is_array($result["matches"])) {
         $tids = '';
         foreach ($result["matches"] as $docinfo) {
             $tids && ($tids .= ',');
             if (strpos($index, 'tmsgs') !== false || strpos($index, 'threads') !== false) {
                 $tids .= $docinfo['id'];
             } else {
                 $tids .= $docinfo['attrs']['tid'];
             }
         }
         return array($totals, $tids, $words);
     } else {
         return false;
     }
 }
开发者ID:adi00,项目名称:wumaproject,代码行数:23,代码来源:search.class.php

示例15: ecs_iconv

function ecs_iconv($source_lang, $target_lang, $source_string = '')
{
    static $chs = NULL;

    /* 如果字符串为空或者字符串不需要转换,直接返回 */
    if ($source_lang == $target_lang || $source_string == '' || preg_match("/[\x80-\xFF]+/", $source_string) == 0)
    {
        return $source_string;
    }

    if ($chs === NULL)
    {
        require_once(ROOT_PATH . 'includes/cls_iconv.php');
        $chs = new Chinese(ROOT_PATH);
    }

    return $chs->Convert($source_lang, $target_lang, $source_string);
}
开发者ID:Richerjx,项目名称:ecshop,代码行数:18,代码来源:lib_base.php


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