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


PHP Chinese::convert方法代码示例

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


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

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

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

示例3: libfile

     require_once libfile('class/chinese');
     $chs = new Chinese('utf-8', CHARSET);
 }
 $parser = xml_parser_create();
 xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
 xml_parse_into_struct($parser, $data, $values, $index);
 xml_parser_free($parser);
 $xmldata = array('chanl', 'fid', 'title', 'tid', 'author', 'pdate', 'rdate', 'rnum', 'vnum', 'insite');
 $relatedthreadlist = $keywords = array();
 $nextuptime = 0;
 foreach ($index as $tag => $valuearray) {
     if (in_array($tag, $xmldata)) {
         foreach ($valuearray as $key => $value) {
             if ($values[$index['title'][$key]]['value']) {
                 $relatedthreadlist[$key][$tag] = !empty($chs) ? $chs->convert(trim($values[$value]['value'])) : trim($values[$value]['value']);
                 $relatedthreadlist[$key]['fid'] = !$values[$index['fid'][$key]]['value'] ? preg_replace("/(.+?)\\/forum\\-(\\d+)\\-(\\d+)\\.html/", "\\2", trim($values[$index['curl'][$key]]['value'])) : trim($values[$index['fid'][$key]]['value']);
                 $relatedthreadlist[$key]['tid'] = !$values[$index['tid'][$key]]['value'] ? preg_replace("/(.+?)\\/thread\\-(\\d+)\\-(\\d+)-(\\d+)\\.html/", "\\2", trim($values[$index['surl'][$key]]['value'])) : trim($values[$index['tid'][$key]]['value']);
             }
         }
     } elseif (in_array($tag, array('kw', 'ekw'))) {
         $type = $tag == 'kw' ? 'general' : 'trade';
         foreach ($valuearray as $value) {
             $keywords[$type][] = !empty($chs) ? $chs->convert(trim($values[$value]['value'])) : trim($values[$value]['value']);
         }
     } elseif ($tag == 'nextuptime') {
         $nextuptime = $values[$index['nextuptime'][0]]['value'];
     } elseif ($tag == 'keep' && intval($values[$index['keep'][0]]['value'])) {
         exit;
     }
 }
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:31,代码来源:forum_relatethread.php

示例4: gbToUTF8

/**
 * GBK字符串转utf8为字符串
 * @param string $str 要转换的字符串
 * @return void
 */
function gbToUTF8($str)
{
    static $chinese = NULL;
    if ($chinese === NULL) {
        require_once fimport('class/chinese');
        $chinese = new Chinese('GBK', 'UTF-8');
    }
    return $chinese->convert($str);
}
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:14,代码来源:global.func.php

示例5: rawurlencode

$messageenc = rawurlencode(strip_tags(preg_replace("/\\[.+?\\]/U", '', $message)));
$data = @implode('', file("http://keyword.discuz.com/related_kw.html?ics=" . CHARSET . "&ocs=" . CHARSET . "&title={$subjectenc}&content={$messageenc}"));
if ($data) {
    if (PHP_VERSION > '5' && CHARSET != 'utf-8') {
        require_once libfile('class/chinese');
        $chs = new Chinese('utf-8', CHARSET);
    }
    $parser = xml_parser_create();
    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    xml_parse_into_struct($parser, $data, $values, $index);
    xml_parser_free($parser);
    $kws = array();
    foreach ($values as $valuearray) {
        if ($valuearray['tag'] == 'kw' || $valuearray['tag'] == 'ekw') {
            $kws[] = !empty($chs) ? $chs->convert(trim($valuearray['value'])) : trim($valuearray['value']);
        }
    }
    $return = '';
    if ($kws) {
        foreach ($kws as $kw) {
            $kw = dhtmlspecialchars($kw);
            $return .= $kw . ',';
        }
        $return = dhtmlspecialchars($return);
    }
    $return = substr($return, 0, strlen($return) - 1);
    if (!$tid) {
        $_G['inajax'] = 1;
        include template('forum/relatekw');
    } elseif ($kws) {
开发者ID:softhui,项目名称:discuz,代码行数:31,代码来源:forum_relatekw.php

示例6: dz_get_tag

function dz_get_tag($subject, $message, $return_array = 0)
{
    if (VIP) {
        return FALSE;
    }
    if (empty($subject) && empty($message)) {
        return FALSE;
    }
    $subjectenc = rawurlencode(strip_tags($subject));
    $message = strip_tags(preg_replace("/\\[.+?\\]/U", '', $message));
    $message = cutstr($message, 960, '');
    $messageenc = rawurlencode($message);
    $data = @implode('', file("http://keyword.discuz.com/related_kw.html?ics=" . CHARSET . "&ocs=" . CHARSET . "&title={$subjectenc}&content={$messageenc}"));
    if (!$data) {
        return FALSE;
    }
    if (PHP_VERSION > '5' && CHARSET != 'utf-8') {
        require_once libfile('class/chinese');
        $chs = new Chinese('utf-8', CHARSET);
    }
    $parser = xml_parser_create();
    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    xml_parse_into_struct($parser, $data, $values, $index);
    xml_parser_free($parser);
    $kws = array();
    foreach ($values as $valuearray) {
        if ($valuearray['tag'] == 'kw' || $valuearray['tag'] == 'ekw') {
            $kws[] = !empty($chs) ? $chs->convert(trim($valuearray['value'])) : trim($valuearray['value']);
        }
    }
    if ($return_array) {
        return $kws;
    }
    $return = '';
    if ($kws) {
        foreach ($kws as $kw) {
            $kw = htmlspecialchars($kw);
            $return .= $kw . ' ';
        }
        $return = htmlspecialchars($return);
    }
    return $return;
}
开发者ID:edmundwong,项目名称:V604,代码行数:44,代码来源:function.article.php


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