• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP utf82gb函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了utf82gb函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
                 }
             }
         }
     }
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:35,代码来源:dedemodule.class.php


示例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 = '';
 }
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:7,代码来源:pub_splitword_www.php


示例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;
}
开发者ID:hensonvip,项目名称:ymroad,代码行数:67,代码来源:inc_coonepage.php


示例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';
}
开发者ID:uhgy,项目名称:phppractice,代码行数:62,代码来源:memberlogin.class.php


示例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();
 }
开发者ID:healthguo,项目名称:PHP,代码行数:17,代码来源:slide.php


示例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();
 }
开发者ID:healthguo,项目名称:PHP,代码行数:46,代码来源:index.php


示例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';
}
开发者ID:klr2003,项目名称:sourceread,代码行数:38,代码来源:memberlogin.class.php


示例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 {
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:archives_do.php


示例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);
         }
     }
 }
开发者ID:soonfine,项目名称:leread,代码行数:26,代码来源:dedecollection.class.php


示例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;
}
开发者ID:stonelf,项目名称:mcgmh,代码行数:61,代码来源:dedecollection.func.php


示例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) . ",";
开发者ID:qinlibingfeng,项目名称:CallCenter,代码行数:31,代码来源:p_list.php


示例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();">
开发者ID:iabing,项目名称:mzzyc,代码行数:31,代码来源:config_pay_tenpay.php


示例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);
		}
	}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:10,代码来源:pub_collection.php


示例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);
    }
}
开发者ID:tanny2015,项目名称:DataStructure,代码行数:9,代码来源:splitword.func.php


示例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{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{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;
 }
开发者ID:CMS-CHINA,项目名称:secondary-development-of-Dedecms,代码行数:54,代码来源:datalistcp.class.php


示例16: dd2char

function dd2char($dd){
	if($GLOBALS['cfg_ver_lang']=='utf-8') $dd = utf82gb($dd);
	$slen = strlen($dd);
	$okdd = "";
	for($i=0;$i<$slen;$i++){
		if(isset($dd[$i+1]))
		{
			$n = $dd[$i].$dd[$i+1];
			if(($n>96 && $n<123)||($n>64 && $n<91)){
				$okdd .= chr($n); $i++;
			}
			else $okdd .= $dd[$i];
		}else $okdd .= $dd[$i];
	}
	return $okdd;
}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:16,代码来源:inc_functions.php


示例17: save_detail_excel

function save_detail_excel($sql, $file_name, $file_type = "xls")
{
    global $db_conn;
    if ($sql != "") {
        set_time_limit(0);
        ini_set('memory_limit', '600M');
        $rows = mysqli_query($db_conn, $sql);
        $row_counts_list = mysqli_num_rows($rows);
        $field_count = mysqli_num_fields($rows);
        $fields = mysqli_fetch_fields($rows);
        if ($row_counts_list != 0) {
            //文档类型
            if ($file_type == "xls") {
                //记录集个数小于2000,使用phpexcel生成xls
                /*if ($row_counts_list<2000 and $field_count<12) {
                  include("../plugin/excel.php");
                  //当前活动表
                  $objPHPExcel->setActiveSheetIndex(0);
                  //sheet表名
                  $objPHPExcel->getActiveSheet()->setTitle("".$file_name."");
                  $field_count2=$field_count-1;
                  $objPHPExcel->getActiveSheet()->setSharedStyle($excel_tit_left, "A1:$tit_arr[$field_count2]1");	
                  $objPHPExcel->getActiveSheet()->setSharedStyle($excel_list_left, "A2:$tit_arr[$field_count2]".($row_counts_list+1));
                  for ($i=0;$i<$field_count;$i++){
                  $objPHPExcel->getActiveSheet()->setCellValue("$tit_arr[$i]1","".$fields[$i]->name."");
                  }
                  $i=1;
                  while($rs= mysqli_fetch_array($rows)){ 
                  $i+=1;
                  for ($k=0;$k<$field_count;$k++){
                  
                  $objPHPExcel->getActiveSheet()->getCell($tit_arr[$k].$i)->setValueExplicit($rs[$k], PHPExcel_Cell_DataType::TYPE_STRING);
                  
                  }
                  //if($i%100==0){
                  //	ob_flush();
                  //	flush();
                  //}
                  }
                  $objPHPExcel->setActiveSheetIndex(0);
                  
                  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
                  $file_path=excel_file("".$file_name."_","xls");
                  $objWriter->save(str_replace('.php', '.xls',$file_path[2]));
                  
                  }else{*/
                //记录集个数大于2000,使用XML生成xls
                include "Spreadsheet/Excel/Writer.php";
                $file_path = excel_file("" . $file_name . "_", "xls");
                $workbook = new Spreadsheet_Excel_Writer($file_path[2]);
                $workbook->setCustomColor(20, 146, 208, 80);
                $format_title_sty =& $workbook->addformat(array('Size' => 10, 'Bold' => 1, 'Border' => 1, 'FgColor' => 20, 'FontFamily' => utf82gb("宋体")));
                $format_cont_sty =& $workbook->addformat(array('Size' => 10, 'Border' => 1, 'FontFamily' => utf82gb("宋体")));
                $sheet_rows = 40000;
                //单Sheet记录集个数
                $sheet_id = 0;
                $i = 0;
                $sheet_i = 0;
                while ($rs = mysqli_fetch_array($rows)) {
                    $i++;
                    $sheet_i++;
                    $row_ = $i % $sheet_rows;
                    if ($row_ == 1) {
                        if ($row_counts_list < $sheet_rows + 1) {
                            $sheet_id = "";
                        } else {
                            $sheet_id++;
                        }
                        $sheets =& $workbook->addWorksheet("" . utf82gb($file_name . $sheet_id) . "");
                        for ($f = 0; $f < $field_count; $f++) {
                            $sheets->writeString(0, $f, utf82gb($fields[$f]->name), $format_title_sty);
                        }
                        $sheet_i = 1;
                    }
                    for ($k = 0; $k < $field_count; $k++) {
                        $sheets->writeString($sheet_i, $k, utf82gb($rs[$k]), $format_cont_sty);
                    }
                }
                $workbook->close();
                //}
            } elseif ($file_type == "xml_xls") {
                $file_type = "xls";
                $file_path = excel_file("" . $file_name . "_", $file_type);
                $fp = fopen($file_path[2], "w");
                $sheet_rows = 40000;
                //单Sheet记录集个数
                $xml_head = "<?xml version=\"1.0\"?>\n<?mso-application progid=\"Excel.Sheet\"?>\n<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:html=\"http://www.w3.org/TR/REC-html40\"><DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\"><Title>详单数据导出</Title><Author>亚铭科技</Author><Category>详单、汇总</Category>\n<Company>亚铭科技</Company></DocumentProperties>\n<OfficeDocumentSettings xmlns=\"urn:schemas-microsoft-com:office:office\"><AllowPNG/> <RemovePersonalInformation/></OfficeDocumentSettings><ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\"> <WindowHeight>8010</WindowHeight><WindowWidth>14805</WindowWidth><WindowTopX>240</WindowTopX><WindowTopY>105</WindowTopY>\n<ProtectStructure>False</ProtectStructure><ProtectWindows>False</ProtectWindows></ExcelWorkbook>\n<Styles>\n<Style ss:ID=\"Default\" ss:Name=\"Normal\"><Alignment ss:Vertical=\"Bottom\"/><Borders/><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"10\" ss:Color=\"#000000\"/><Interior/><NumberFormat/><Protection/></Style><Style ss:ID=\"s71\"><Alignment ss:Vertical=\"Center\"/><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Color=\"#000000\"/><NumberFormat ss:Format=\"@\"/></Style><Style ss:ID=\"s72\"><Alignment ss:Vertical=\"Center\"/><Borders>\n<Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Color=\"#000000\" ss:Bold=\"1\"/> <Interior ss:Color=\"#92D050\" ss:Pattern=\"Solid\"/><NumberFormat ss:Format=\"@\"/></Style></Styles>";
                fwrite($fp, $xml_head);
                for ($i = 0; $i < $field_count; $i++) {
                    $filed_list .= "<Cell ss:StyleID=\"s72\"><Data ss:Type=\"String\">" . $fields[$i]->name . "</Data></Cell>";
                }
                $xml_sheet_head_row = "<Row>" . ($filed_list .= "</Row>");
                $i = 0;
                $sheet_id = 0;
                while ($rs = mysqli_fetch_array($rows)) {
                    $i++;
                    $style = "";
                    $f_list = "";
                    $row_ = $i % $sheet_rows;
                    if ($row_ == 1) {
//.........这里部分代码省略.........
开发者ID:qinlibingfeng,项目名称:CallCenter,代码行数:101,代码来源:pub_func.php


示例18: changyan_autoCharset

function changyan_autoCharset($msg, $type = 'out')
{
    global $cfg_soft_lang;
    if ($cfg_soft_lang == 'gb2312') {
        if ($type == 'out') {
            return gb2utf8($msg);
        } else {
            return utf82gb($msg);
        }
    }
    return $msg;
}
开发者ID:ChangyanTech,项目名称:Changyan,代码行数:12,代码来源:changyan.helper.php


示例19: preg_match_all

     $rs['huilian'] = "<font color=red>²éѯʧ°Ü£¬ÇëÖØÊÔ</font>";
 } else {
     preg_match_all("/<a[^>]*?http:\\/\\/[^>]*?>.*?<\\/a>/i", $output, $mt);
     if (preg_match('/charset=utf-8/i', $output)) {
         $char = 'utf-8';
     }
     $v = array();
     $n = 0;
     foreach ($mt[0] as $r) {
         if (strpos($r, $url) === false) {
             $n++;
         }
         if (strpos($r, $myurl) !== false) {
             $hlname = strip_tags($r);
             if (!empty($char) && $cfg_soft_lang != $char) {
                 $hlname = utf82gb($hlname);
             } elseif (empty($char) && $cfg_soft_lang != 'gb2312') {
                 $hlname = gb2utf8($hlname);
             }
         }
     }
     if (empty($hlname)) {
         $rs['huilian'] = "<font color=red>Ê×Ò³ÎÞ±¾Õ¾Á´½Ó</font>";
     } else {
         $rs['huilian'] = "Á´½Ó:" . $hlname . " ÍâÁ´Êý:" . $n;
     }
 }
 if ($cfg_soft_lang == 'gb2312') {
     $rs['huilian'] = gb2utf8($rs['huilian']);
 }
 echo json_encode($rs);
开发者ID:soonfine,项目名称:leread,代码行数:31,代码来源:friendlink_check.php


示例20: ac_import

 function ac_import()
 {
     global $cfg_soft_lang;
     $id = $this->gv("id");
     $sub = $this->gv('sub');
     if (empty($sub)) {
         $this->display();
     } else {
         $all = 0;
         $index = 0;
         $con = $this->gv('con');
         if (empty($con)) {
             showmsg("尚未输入采集规则", -1);
             exit;
         }
         $cons = explode("---", $con);
         foreach ($cons as $r) {
             $index++;
             if (!empty($r)) {
                 //$test = explode("#",$r);
                 //if(count($test)<=4){
                 //echo "{$index}、规则不规范,请不要修改规则<br>";continue;
                 //}
                 $r = stripslashes($r);
                 if (!empty($r) && preg_match("/<data(.*)<\\/data>/siU", $r, $mt)) {
                     $n = strpos($mt[1], '>');
                     $s = trim(substr($mt[1], 0, $n));
                     $e = trim(substr($mt[1], $n + 1));
                     $s = str_replace(array(" ", '"'), array("&", ""), $s);
                     @parse_str($s, $arr);
                     if (count($arr) != 5) {
                         echo "{$index}、无法识别规则<br>";
                         continue;
                     }
                     $hash = md5($e);
                     if ($hash != $arr['hash']) {
                         //echo "{$index}、非法规则<br>";continue;
                     }
                     if ($arr['charset'] != $cfg_soft_lang) {
                         if ($arr['charset'] == 'gb2312') {
                             $e = gb2utf8($e);
                         } else {
                             $e = utf82gb($e);
                         }
                     }
                     $d['typeid'] = $id;
                     $d['type'] = $arr['type'];
                     if ($d['type'] != 0) {
                         $d['keyword'] = $e;
                         if (!cjxdb("kwkeyword")->where("keyword='{$d['keyword']}'")->find()) {
                             cjxdb("kwkeyword")->insert($d);
                         } else {
                             echo "{$index}、有相同规则已存在<br>";
                             continue;
                         }
                     } else {
                         $es = explode(',', $e);
                         foreach ($es as $er) {
                             $d['keyword'] = $er;
                             if (!cjxdb("kwkeyword")->where("keyword='{$d['keyword']}'")->find()) {
                                 cjxdb("kwkeyword")->insert($d);
                             } else {
                                 echo "{$index}、有相同规则已存在<br>";
                                 continue;
                             }
                         }
                     }
                     echo "{$index}、导入成功<br>";
                     $all++;
                 }
             }
         }
         showmsg("完成导入{$all}条规则", "?ac=task");
     }
 }
开发者ID:soonfine,项目名称:leread,代码行数:75,代码来源:cjx.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP utf8RawUrlDecode函数代码示例发布时间:2022-05-23
下一篇:
PHP ut_run函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap