本文整理汇总了PHP中utf82gb函数的典型用法代码示例。如果您正苦于以下问题:PHP utf82gb函数的具体用法?PHP utf82gb怎么用?PHP utf82gb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf82gb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AppCode
function AppCode(&$str)
{
if ($this->moduleLang == $this->sysLang) {
return $str;
} else {
if ($this->sysLang == 'utf-8') {
if ($this->moduleLang == 'gbk') {
return gb2utf8($str);
}
if ($this->moduleLang == 'big5') {
return gb2utf8(big52gb($str));
}
} else {
if ($this->sysLang == 'gbk') {
if ($this->moduleLang == 'utf-8') {
return utf82gb($str);
}
if ($this->moduleLang == 'big5') {
return big52gb($str);
}
} else {
if ($this->sysLang == 'big5') {
if ($this->moduleLang == 'utf-8') {
return gb2big5(utf82gb($str));
}
if ($this->moduleLang == 'gbk') {
return gb2big5($str);
}
} else {
return $str;
}
}
}
}
}
示例2: SetSource
function SetSource($str)
{
global $cfg_ver_lang;
if($cfg_ver_lang=='utf-8') $str = utf82gb($str);
$this->SourceString = trim($this->ReviseString($str));
$this->ResultString = '';
}
示例3: CoOnePage
/**
* 获取一个页面
*
* @access public
* @param string $gurl 操作地址
* @return string
*/
function CoOnePage($gurl)
{
global $dsql, $cfg_auot_description, $cfg_soft_lang;
$redatas = array('title' => '', 'body' => '', 'source' => '', 'writer' => '', 'description' => '', 'keywords' => '');
$redatas['source'] = preg_replace("/http:\\/\\//i", "", $gurl);
$redatas['source'] = preg_replace("/\\/(.*)\$/i", "", $redatas['source']);
$row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '" . $redatas['source'] . "' ");
$s = $e = '';
if (is_array($row)) {
list($s, $e) = explode('{@body}', $row['rule']);
$s = trim($s);
$e = trim($e);
if ($row['issource'] == 1) {
$redatas['source'] = $row['title'];
}
}
$htd = new DedeHttpDown();
$htd->OpenUrl($gurl);
$body = $htd->GetHtml();
if ($body != '') {
//编码自动转换
if ($cfg_soft_lang == 'utf-8') {
if ($row['lang'] == 'gb2312') {
$body = gb2utf8($body);
}
} else {
if ($cfg_soft_lang == 'gb2312') {
if ($row['lang'] == 'utf-8') {
$body = utf82gb($body);
}
}
}
//获取标题
$inarr = array();
preg_match("/<title>(.*)<\\/title>/isU", $body, $inarr);
if (isset($inarr[1])) {
$redatas['title'] = $inarr[1];
}
//获取关键词
$inarr = array();
preg_match("/<meta[\\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU", $body, $inarr);
if (isset($inarr[1])) {
$redatas['keywords'] = cn_substr(html2text($inarr[1]), 30);
}
//获取摘要
$inarr = array();
preg_match("/<meta[\\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU", $body, $inarr);
if (isset($inarr[1])) {
$redatas['description'] = cn_substr(html2text($inarr[1]), $cfg_auot_description);
}
//获取内容
if ($s != '' && $e != '') {
$redatas['body'] = GetHtmlAreaA($s, $e, $body);
if ($redatas['body'] != '' && $redatas['description'] == '') {
$redatas['description'] = cn_substr(html2text($redatas['body']), $GLOBALS['cfg_auot_description']);
}
}
}
return $redatas;
}
示例4: CheckUserID
/**
* 检查用户名的合法性
*
* @access public
* @param string $uid 用户UID
* @param string $msgtitle 提示标题
* @param string $ckhas 检查是否存在
* @return string
*/
function CheckUserID($uid, $msgtitle='用户名', $ckhas=TRUE)
{
global $cfg_mb_notallow,$cfg_mb_idmin,$cfg_md_idurl,$cfg_soft_lang,$dsql;
if($cfg_mb_notallow != '')
{
$nas = explode(',', $cfg_mb_notallow);
if(in_array($uid, $nas))
{
return $msgtitle.'为系统禁止的标识!';
}
}
if($cfg_md_idurl=='Y' && preg_match("/[^a-z0-9]/i",$uid))
{
return $msgtitle.'必须由英文字母或数字组成!';
}
if($cfg_soft_lang=='utf-8')
{
$ck_uid = utf82gb($uid);
}
else
{
$ck_uid = $uid;
}
for($i=0; isset($ck_uid[$i]); $i++)
{
if(ord($ck_uid[$i]) > 0x80)
{
if(isset($ck_uid[$i+1]) && ord($ck_uid[$i+1])>0x40)
{
$i++;
}
else
{
return $msgtitle.'可能含有乱码,建议你改用英文字母和数字组合!';
}
}
else
{
if(preg_match("/[^0-9a-z@\.-]/i",$ck_uid[$i]))
{
return $msgtitle.'不能含有 [@]、[.]、[-]以外的特殊符号!';
}
}
}
if($ckhas)
{
$row = $dsql->GetOne("SELECT * FROM `#@__member` WHERE userid LIKE '$uid' ");
if(is_array($row)) return $msgtitle."已经存在!";
}
return 'ok';
}
示例5: ac_index
function ac_index()
{
global $cfg_soft_lang;
if (file_exists(DEDEASK . "/data/cache/slide.inc")) {
require_once DEDEASK . "/data/cache/slide.inc";
if ($cfg_soft_lang == 'utf-8') {
$row = AutoCharset(unserialize(utf82gb($data)));
} else {
$row = unserialize($data);
}
}
//设定变量值
$GLOBALS['row'] = $row;
//载入模板
$this->SetTemplate('slide.htm');
$this->Display();
}
示例6: ac_index
function ac_index()
{
global $cfg_soft_lang;
$row = 8;
//推荐问题
$digests = $this->question->get_digests(7);
//待解决的问题
$notoks = $this->question->get_all('status=0', 'ORDER BY disorder DESC, dateline DESC', $row);
//新解决的问题
$solutions = $this->question->get_all('status=1', 'ORDER BY solvetime DESC', $row);
//高分悬赏问题
$rewards = $this->question->get_all('status=0', 'ORDER BY reward DESC', $row);
//获取问题数
$solvenum = $this->question->get_total();
//首页幻灯片
if (file_exists(DEDEASK . "/data/cache/slide.inc")) {
require_once DEDEASK . "/data/cache/slide.inc";
if ($cfg_soft_lang == 'utf-8') {
$row = AutoCharset(unserialize(utf82gb($data)));
} else {
$row = unserialize($data);
}
}
//处理链接地址
if ($GLOBALS['cfg_ask_rewrite'] == 'Y') {
$digests = makerewurl($digests, 'id');
$notoks = makerewurl($notoks, 'id');
$solutions = makerewurl($solutions, 'id');
$rewards = makerewurl($rewards, 'id');
} else {
$digests = makeurl($digests, 'id');
$notoks = makeurl($notoks, 'id');
$solutions = makeurl($solutions, 'id');
$rewards = makeurl($rewards, 'id');
}
//设定变量值
$GLOBALS['row'] = $row;
$GLOBALS['digests'] = $digests;
$GLOBALS['notoks'] = $notoks;
$GLOBALS['rewards'] = $rewards;
$GLOBALS['solutions'] = $solutions;
$GLOBALS['solvenum'] = $solvenum;
//载入模板
$this->SetTemplate('index.htm');
$this->Display();
}
示例7: CheckUserID
function CheckUserID($uid, $msgtitle = '用户名', $ckhas = true)
{
global $cfg_mb_notallow, $cfg_mb_idmin, $cfg_md_idurl, $cfg_soft_lang, $dsql;
if ($cfg_mb_notallow != '') {
$nas = explode(',', $cfg_mb_notallow);
if (in_array($uid, $nas)) {
return $msgtitle . '为系统禁止的标识!';
}
}
if ($cfg_md_idurl == 'Y' && eregi("[^a-z0-9]", $uid)) {
return $msgtitle . '必须由英文字母或数字组成!';
}
if ($cfg_soft_lang == 'utf-8') {
$ck_uid = utf82gb($uid);
} else {
$ck_uid = $uid;
}
for ($i = 0; isset($ck_uid[$i]); $i++) {
if (ord($ck_uid[$i]) > 0x80) {
if (isset($ck_uid[$i + 1]) && ord($ck_uid[$i + 1]) > 0x40) {
$i++;
} else {
return $msgtitle . '可能含有乱码,建议你改用英文字母和数字组合!';
}
} else {
if (eregi("[^0-9a-z@\\.-]", $ck_uid[$i])) {
return $msgtitle . '不能含有 [@]、[.]、[-]以外的特殊符号!';
}
}
}
if ($ckhas) {
$row = $dsql->GetOne("Select * From `#@__member` where userid like '{$uid}' ");
if (is_array($row)) {
return $msgtitle . "已经存在!";
}
}
return 'ok';
}
示例8: in
$query = "Select arc.*, addt.* From `#@__archives` arc left join `#@__addonarticle` addt on addt.aid=arc.id where arc.id in({$arcids}) And arc.channel=1 ";
$dsql->SetQuery($query);
$dsql->Execute();
while ($row = $dsql->GetArray()) {
//跳过已经有关键字的内容
if (trim($row['keywords']) != '') {
continue;
}
$aid = $row['id'];
$keywords = '';
$title = $row['title'];
$description = $row['description'];
$body = cn_substr($row['body'], 5000);
if ($cfg_soft_lang == 'utf-8') {
$title = utf82gb($title);
$body = utf82gb($body);
}
$titleindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText($title)));
$allindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText(Html2Text($body), 500)));
if (is_array($allindexs) && is_array($titleindexs)) {
foreach ($titleindexs as $k) {
if (strlen($keywords . $k) >= 30) {
break;
} else {
$keywords .= $k . ',';
}
}
foreach ($allindexs as $k) {
if (strlen($keywords . $k) >= 30) {
break;
} else {
示例9: ChangeCode
/**
* 编码转换
*
* @access public
* @param string $str 字符串
* @return string
*/
function ChangeCode(&$str)
{
global $cfg_soft_lang;
if ($cfg_soft_lang == 'utf-8') {
if ($this->noteInfos["sourcelang"] == "gb2312") {
$str = gb2utf8($str);
}
if ($this->noteInfos["sourcelang"] == "big5") {
$str = gb2utf8(big52gb($str));
}
} else {
if ($this->noteInfos["sourcelang"] == "utf-8") {
$str = utf82gb($str);
}
if ($this->noteInfos["sourcelang"] == "big5") {
$str = big52gb($str);
}
}
}
示例10: GetRssLinks
/**
* 分析RSS里的链接
*
* @access public
* @param string $rssurl rss地址
* @return string
*/
function GetRssLinks($rssurl)
{
global $cfg_soft_lang;
$dhd = new DedeHttpDown();
$dhd->OpenUrl($rssurl);
$rsshtml = $dhd->GetHtml();
//分析编码
preg_match("/encoding=[\"']([^\"']*)[\"']/is", $rsshtml, $infos);
if (isset($infos[1])) {
$pcode = strtolower(trim($infos[1]));
} else {
$pcode = strtolower($cfg_soft_lang);
}
if ($cfg_soft_lang == 'gb2312') {
if ($pcode == 'utf-8') {
$rsshtml = utf82gb($rsshtml);
} else {
if ($pcode == 'big5') {
$rsshtml = big52gb($rsshtml);
}
}
} else {
if ($cfg_soft_lang == 'utf-8') {
if ($pcode == 'gbk' || $pcode == 'gb2312') {
$rsshtml = gb2utf8($rsshtml);
} else {
if ($pcode == 'big5') {
$rsshtml = gb2utf8(big52gb($rsshtml));
}
}
}
}
$rsarr = array();
preg_match_all("/<item(.*)<title>(.*)<\\/title>/isU", $rsshtml, $titles);
preg_match_all("/<item(.*)<link>(.*)<\\/link>/isU", $rsshtml, $links);
preg_match_all("/<item(.*)<description>(.*)<\\/description>/isU", $rsshtml, $descriptions);
if (!isset($links[2])) {
return '';
}
foreach ($links[2] as $k => $v) {
$rsarr[$k]['link'] = RpCdata($v);
if (isset($titles[2][$k])) {
$rsarr[$k]['title'] = RpCdata($titles[2][$k]);
} else {
$rsarr[$k]['title'] = preg_replace("/^(.*)\\//i", "", RpCdata($titles[2][$k]));
}
if (isset($descriptions[2][$k])) {
$rsarr[$k]['image'] = GetddImgFromRss($descriptions[2][$k], $rssurl);
} else {
$rsarr[$k]['image'] = '';
}
}
return $rsarr;
}
示例11: utf82gb
$result = "不存在";
$bcz_count += 1;
}
} else {
$wav_name .= ".wav";
$result = "无录音";
$wly_count += 1;
}
//$result_sql.="('".$wav_name."','".$result."','','".$job_id."'),";
$copy_log = $phone_number . "\t" . $cam_dir2 . "/" . $wav_name . "\t" . utf82gb($result) . "\r\n";
fwrite($fp, $copy_log);
}
$false_count = $sb_count + $bcz_count + $wly_count;
//echo $up_job_sql;
$copy_logs = "\r\n\r\n共:" . $sum_count . "个,成功:" . $true_count . "个,失败:" . $false_count . "个(处理失败:" . $sb_count . ",文件不存在:" . $bcz_count . ",无录音:" . $wly_count . ")";
fwrite($fp, utf82gb($copy_logs));
//fclose($fp);
$wav_file_list = "";
$counts = "1";
$des = "拷贝完成,即将开始压缩处理,请稍后...";
$result = "共:<span class=\"red\">" . $sum_count . "</span>个,成功:<span class=\"red\">" . $true_count . "</span>个,失败:<span class=\"red\">" . $false_count . "</span> 个(处理失败:<span class=\"red\">" . $sb_count . "</span>,文件不存在:<span class=\"red\">" . $bcz_count . "</span>,无录音:<span class=\"red\">" . $wly_count . "</span>)";
} else {
$counts = "0";
$des = "未找到符合条件的数据!";
fwrite($fp, $des);
}
fclose($fp);
mysqli_free_result($rows);
$json_data = "{";
$json_data .= "\"counts\":" . json_encode($counts) . ",";
$json_data .= "\"des\":" . json_encode($des) . ",";
示例12: time
如果sp_billno不足10位, 则左补0, 加到transaction_id后部*/
$strTransactionId = $strSpid . $strBillDate . time();
/*货币类型: 1 – RMB(人民币) 2 - USD(美元) 3 - HKD(港币)*/
$strFeeType = "1";
/*财付通回调页面地址, 推荐使用ip地址的方式(最长255个字符)*/
$strRetUrl = $cfg_basehost . "/member/paycenter/tenpay/notify_handler.php";
/*商户私有数据, 请求回调页面时原样返回*/
$strAttach = "my_magic_string";
/*生成MD5签名*/
$strSignText = "cmdno=" . $strCmdNo . "&date=" . $strBillDate . "&bargainor_id=" . $strSaler . "&transaction_id=" . $strTransactionId . "&sp_billno=" . $strSpBillNo . "&total_fee=" . $strTotalFee . "&fee_type=" . $strFeeType . "&return_url=" . $strRetUrl . "&attach=" . $strAttach . "&key=" . $strSpkey;
$strSign = strtoupper(md5($strSignText));
/*请求支付串*/
$strRequest = "cmdno=" . $strCmdNo . "&date=" . $strBillDate . "&bargainor_id=" . $strSaler . "&transaction_id=" . $strTransactionId . "&sp_billno=" . $strSpBillNo . "&total_fee=" . $strTotalFee . "&fee_type=" . $strFeeType . "&return_url=" . $strRetUrl . "&attach=" . $strAttach . "&bank_type=" . $strBankType . "&desc=" . $strDesc . "&purchaser_id=" . $strBuyerId . "&sign=" . $strSign;
$strRequestUrl = "https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi?" . $strRequest;
if ($cfg_soft_lang == 'utf-8') {
$strRequestUrl = utf82gb($strRequestUrl);
echo '<html>
<head>
<title>转到财付通支付页面</title>
</head>
<body onload="document.tenpay.submit();">
<form name="tenpay" action="paycenter/tenpay/tenpay_gbk_page.php?strReUrl=' . urlencode($strRequestUrl) . '" method="post">
</form>
</body>
</html>';
} else {
echo '<html>
<head>
<title>转到财付通支付页面</title>
</head>
<body onload="document.tenpay.submit();">
示例13: ChangeCode
function ChangeCode(&$str)
{
if($GLOBALS['cfg_ver_lang']=='utf-8'){
if($this->Item["language"]=="gb2312") $str = gb2utf8($str);
if($this->Item["language"]=="big5") $str = gb2utf8(big52gb($str));
}else{
if($this->Item["language"]=="utf-8") $str = utf82gb($str);
if($this->Item["language"]=="big5") $str = big52gb($str);
}
}
示例14: cn_substr
function cn_substr($str, $slen, $startdd = 0)
{
if ($charset == 'utf-8') {
$str = utf82gb($str);
return gb2utf8(cn_substrGb($str, $slen, $startdd));
} else {
return cn_substrGb($str, $slen, $startdd);
}
}
示例15: RemoveXss
function RemoveXss($val)
{
global $cfg_soft_lang;
if ($cfg_soft_lang == 'gb2312') {
gb2utf8($val);
}
$val = preg_replace('/([\\x00-\\x08,\\x0b-\\x0c,\\x0e-\\x19])/', '', $val);
$search = 'abcdefghijklmnopqrstuvwxyz';
$search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$search .= '1234567890!@#$%^&*()';
$search .= '~`";:?+/={}[]-_|\'\\';
for ($i = 0; $i < strlen($search); $i++) {
$val = preg_replace('/(&#[xX]0{0,8}' . dechex(ord($search[$i])) . ';?)/i', $search[$i], $val);
// with a ;
$val = preg_replace('/(�{0,8}' . ord($search[$i]) . ';?)/', $search[$i], $val);
// with a ;
}
$val = str_replace("`", "‘", $val);
$val = str_replace("'", "‘", $val);
$val = str_replace("\"", "“", $val);
$val = str_replace(",", ",", $val);
$val = str_replace("(", "(", $val);
$val = str_replace(")", ")", $val);
$ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');
$ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');
$ra = array_merge($ra1, $ra2);
$found = true;
while ($found == true) {
$val_before = $val;
for ($i = 0; $i < sizeof($ra); $i++) {
$pattern = '/';
for ($j = 0; $j < strlen($ra[$i]); $j++) {
if ($j > 0) {
$pattern .= '(';
$pattern .= '(&#[xX]0{0,8}([9ab]);)';
$pattern .= '|';
$pattern .= '|(�{0,8}([9|10|13]);)';
$pattern .= ')*';
}
$pattern .= $ra[$i][$j];
}
$pattern .= '/i';
$replacement = substr($ra[$i], 0, 2) . '<x>' . substr($ra[$i], 2);
$val = preg_replace($pattern, $replacement, $val);
if ($val_before == $val) {
$found = false;
}
}
}
if ($cfg_soft_lang == 'gb2312') {
utf82gb($val);
}
return $val;
}