本文整理汇总了PHP中get_utf8_string函数的典型用法代码示例。如果您正苦于以下问题:PHP get_utf8_string函数的具体用法?PHP get_utf8_string怎么用?PHP get_utf8_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_utf8_string函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: po_chengji
function po_chengji($str, $xh, $name, $ch, $link)
{
$zxfxj = get_utf8_string("%实得总学分小计:");
$pjxfjd = get_utf8_string("%平均学分绩点:");
$zxfjd = get_utf8_string("%总学分绩点");
$str = str_replace("</font></span></td> \t</tr>", "%", $str);
$str = str_replace("</td> \t</tr>", "&】", $str);
$str = str_replace("<tr> \t\t<td>", "【", $str);
$str = str_replace('<tr bgcolor="#C1D8F0"> <td>', "【", $str);
$str = str_replace('<tr bgcolor="#EEF3F9"> <td>', "【", $str);
$str = str_replace('<span id="Szxf"><font color="MediumBlue">', $zxfxj, $str);
$str = str_replace('<span id="pjxfjd">', $pjxfjd, $str);
$str = str_replace('<span id="zxfjd"><font color="DarkRed">', $zxfjd, $str);
$str = str_replace('<span id="yhzxf"><font color="DarkRed">', "%", $str);
$str = str_replace('</font></span>', "%】", $str);
$str = str_replace("<td> </td>", "", $str);
$str = str_replace("<td>", " ", $str);
$str = str_replace("<tr>", "", $str);
$str = str_replace("</tr>", " ", $str);
$str = strip_tags($str);
$str = explode("%", $str);
$str2 = explode("【", $str[0]);
$string = '';
foreach ($str2 as $key => $a) {
if ($key >= 2) {
$a = str_replace("&】", "&&", $a);
$a = str_replace(" \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t", "", $a);
$string = $string . $a;
}
}
$ret = $string . "&" . $str[4] . "&" . $str[6] . "&" . $str[8];
return $ret;
}
示例2: bookinfo
function bookinfo($id)
{
header("Content-type: text/html; charset=utf-8");
$url = 'http://opac.lib.gdpu.edu.cn/cgi-win/tcgid.exe?' . $id;
$string = file_get_contents($url);
$string = get_utf8_string($string);
$str = str_replace('<tr><td>', "【", $string);
$str = str_replace('</td></tr>', "】", $str);
$str = preg_match_all('/【(?P<info>.+?)】+/s', $str, $results);
/*$ret = "【大学城图书馆】\n【3楼】 A-H\n中文社科图书阅览一室(A-H)\n【4楼】 I、J、K\n中文社科图书阅览二室(I、J、K)\n【5楼】R\n中文医药类图书阅览室(R)\n【5楼】N-Z\n中文自然科学书阅览一室(N-Z)";*/
preg_match('/库<\\/td><td align="center">(?P<sqh>.+?)<td align=\\"center\\">/s', $results['info']['0'], $sqh);
$sqh = $sqh['sqh'];
$floor = substr($sqh, 0, 1);
$ret = "【大学城图书馆】\n图书在" . sqh($floor);
foreach ($results['info'] as $v) {
$v = "\n\n" . $v;
$v = str_replace('库</td><td align="center">', "库\n索取号: ", $v);
$v = str_replace('</td><td align="center"> </td><td align="center"> </td><td align="center">', "\n状态: ", $v);
$v = str_replace('</td><td align="center"> ', "\n借阅类型: ", $v);
$v = str_replace('<td align="center">', "\n登录号: ", $v);
//$sqh='索取号: TP391.41/S0203';
//$floor=substr($sqh,11,1);
$ret .= $v;
}
return $ret;
}
示例3: bookinfo
function bookinfo($id)
{
header("Content-type: text/html; charset=utf-8");
$url = 'http://opac.lib.gdpu.edu.cn/cgi-win/tcgid.exe?.$id';
$string = file_get_contents($url);
$string = get_utf8_string($string);
$str = str_replace('<tr><td>', "【", $string);
$str = str_replace('</td></tr>', "】", $str);
$str = preg_match_all('/【(?P<info>.+?)】+/s', $str, $results);
$ret = "【大学城图书馆】\n【3楼】 A-H\n中文社科图书阅览一室(A-H)\n【4楼】 I、J、K\n中文社科图书阅览二室(I、J、K)\n【5楼】R\n中文医药类图书阅览室(R)\n【5楼】N-Z\n中文自然科学书阅览一室(N-Z)";
foreach ($results['info'] as $v) {
$v = "\n\n" . $v;
$v = str_replace('库</td><td align="center">', "库\n索取号: ", $v);
$v = str_replace('</td><td align="center"> </td><td align="center"> </td><td align="center">', "\n状态: ", $v);
$v = str_replace('</td><td align="center"> ', "\n借阅类型: ", $v);
$v = str_replace('<td align="center">', "\n登录号: ", $v);
$ret .= $v;
}
return $ret;
}
示例4: po_chengji
function po_chengji($str, $xh, $name, $ch, $link)
{
$zxfxj = get_utf8_string("%实得总学分小计:");
$pjxfjd = get_utf8_string("%平均学分绩点:");
$zxfjd = get_utf8_string("%总学分绩点");
$str = str_replace("</font></span></td> \t</tr>", "%", $str);
$str = str_replace("</td> \t</tr>", "】", $str);
$str = str_replace("<tr> \t\t<td>", "【", $str);
$str = str_replace('<tr bgcolor="#C1D8F0"> <td>', "【", $str);
$str = str_replace('<tr bgcolor="#EEF3F9"> <td>', "【", $str);
$str = str_replace('<span id="Szxf"><font color="MediumBlue">', $zxfxj, $str);
$str = str_replace('<span id="pjxfjd">', $pjxfjd, $str);
$str = str_replace('<span id="zxfjd"><font color="DarkRed">', $zxfjd, $str);
$str = str_replace('<span id="yhzxf"><font color="DarkRed">', "%", $str);
$str = str_replace('</font></span>', "%】", $str);
$str = str_replace("<td> </td>", "", $str);
$str = str_replace("<td>", " ", $str);
$str = str_replace("<tr>", "", $str);
$str = str_replace("</tr>", " ", $str);
$str = strip_tags($str);
$str = explode("%", $str);
$str2 = explode("【", $str[0]);
$string = '';
foreach ($str2 as $key => $a) {
if ($key >= 2) {
$a = str_replace("】", "\n\n", $a);
$string = $string . $a;
}
}
$ret = $string . "\n" . $str[4] . "\n" . $str[6] . "\n" . $str[8];
if ($string !== "\n\n") {
$sql_po_chengji = "REPLACE INTO `jwc_chengji` (`xh`, `name`,`chengji`, `time`) VALUES ('{$xh}','{$name}', '{$ret}', TIMESTAMP(10));";
$query_char = mysql_query("SET NAMES UTF8");
$query_po_chengji = mysql_query($sql_po_chengji, $link) or die(mysql_error());
}
}
示例5: curl_close
curl_close($ch);
//提取成功之后的ASP.NetSessionId的cookies
//读取操作页面
/*
$geturl_xsxx = 'http://10.50.17.1/xsxx.aspx?xh='.$xh;//个人信息页面
$geturl_xscj = 'http://10.50.17.1/xscj.aspx?xh='.$xh;//学生成绩页面
*/
$geturl_xscj = 'http://10.50.17.1/xscj.aspx?xh=' . $xh;
$header[] = 'Cookie:' . $cookie;
$ch = curl_init($geturl_xscj);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_HEADER, 0);
$string = curl_exec($ch);
//输出内容
$string = get_utf8_string($string);
//转成utf8
$html = new simple_html_dom();
$html->load($string);
$table = $html->find('table[id=DataGrid1]', 0);
$text = $table->outertext;
echo $text;
$html2 = new simple_html_dom();
$html2->load($string);
$table2 = $html2->find('table[id=Table1]', 0);
$text2 = $table2->outertext;
echo $text2;
/*}
}*/
function get_utf8_string($content)
{
示例6: mysql_query
$query_char = mysql_query("SET NAMES UTF8");
$query_name = mysql_query($sql_name, $link) or die(mysql_error());
while ($name_ret = mysql_fetch_row($query_name)) {
$xh = $name_ret[0];
$jb = $name_ret[1];
$xq = $name_ret[2];
$yx = $name_ret[3];
$bj = $name_ret[4];
$xh = $name_ret[5];
$xm = $name_ret[6];
$zkz = $name_ret[7];
//echo $xh.'<br>'.$pw.'<br>'.$name.'<br>'.$nj.'<br><br>';
$ret = "<br>级别----<font color=blue>" . $jb . "</font><br>校区----<font color=blue>" . $xq . "</font><br>院系名称 ----<font color=blue>" . $yx . "</font><br>班级名称----<font color=blue>" . $bj . "</font><br>学号----<font color=blue>" . $xh . "</font><br>姓名----<font color=blue>" . $xm . "</font><br>准考证号----<font color=blue>" . $zkz . "</font><br><br>";
echo $ret;
$cet = get_ours_cet($zkz, $xm);
echo get_utf8_string($cet);
echo "<br><br>";
?>
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Fc8c6b4ac78fb9378987b263d5babdb1a' type='text/javascript'%3E%3C/script%3E"));
</script>
<!--iframe frameborder='0' name='xx' height='50%' width='100%' src="http://yanson.duapp.com/chengji/xuanxiu_chaxun_y_694.php?xh=<?php
echo $xh;
?>
&pw=<?php
echo $pw;
?>
">
</iframe-->
示例7: preg_match_all
$match_content = '/<p(.*?)<\\/P>/';
$match_blogtitle = '/<h2(.*?)<\\/h2>/';
preg_match_all($match_content, $html, $content);
preg_match_all($match_blogtitle, $html, $blogtitle);
$blogtitle = strip_tags($blogtitle[0][0]);
$blogtitle = str_replace(' ', '', $blogtitle);
$cont = "";
foreach ($content[0] as $key => $value) {
$str = strip_tags($value);
$str = str_replace(' ', '', $str);
$cont = $cont . $str;
}
$title = get_utf8_string($blogtitle);
$content = get_utf8_string($cont);
$gdpuer = get_utf8_string('广药小助手');
$weixin = get_utf8_string('微信号:GDPUer');
$html = <<<eot
<script type="text/javascript" src="../script/js/tablesorter.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
\t<meta http-equiv="content-type" content="text/html; charset=utf-8" />
\t<title>{$title}</title>
<meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta charset="utf-8">
示例8: rawurlencode
<?php
$keyword = $_GET['keyword'];
$urlword = rawurlencode(mb_convert_encoding($keyword, 'gb2312', 'utf-8'));
$url = 'http://www.lib.gdpu.edu.cn/was40/outline?page=1&channelid=50301&searchword=' . $urlword . '&ispage=yes';
$html = file_get_contents($url);
$html = get_utf8_string($html);
$list = '/<ul>(.*?)<\\/ul>/is';
preg_match_all($list, $html, $ul, PREG_SET_ORDER);
$ulstr = str_replace(' ', '', $ul[0][1]);
$href = '/http:\\/\\/opac.lib.gdpu.edu.cn\\/cgi-win\\/tcgid.exe?(.*?)"/is';
preg_match_all($href, $ulstr, $id);
$title = '/title="(.*?)"/is';
preg_match_all($title, $ulstr, $bn);
$all = '';
foreach ($id[1] as $key => $value) {
if ($key < 9) {
$value = str_replace('?', '', $value);
$itemurl = 'http://av.jejeso.com/helper/api/book/item.php?id=' . $value;
$bookname = strip_tags($bn[1][$key]);
$str = '@title|' . ($key + 1) . '.' . $bookname . '#url|' . $itemurl . '#pic';
$all = $all . $str;
}
}
if ($all != '') {
echo 'description|信息查询#title|图书信息 找书发送:图书+书名即可' . $all;
} else {
echo '亲,图书馆网站的搜索功能出现问题了,无法帮你查询,请反馈信息给图书馆信息技术部~';
}
function get_utf8_string($content)
{
$encoding = mb_detect_encoding($content, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
示例9: file_get_contents
<?php
$url = 'http://www.gdpu.edu.cn/news/xw/js.asp?BigClassName=%B9%E3%D2%A9%D0%C2%CE%C5&SmallClassName=&ArticleNum=13&ShowType=1&ShowCols=1&ShowProperty=false&ShowBigClassName=false&ShowSmallClassName=false&ShowIncludePic=false&ShowTitle=true&ShowUpdateTime=false&ShowHits=false&ShowAuthor=false&ShowHot=false&ShowMore=false&TitleMaxLen=&ContentMaxLen=&Hot=false&Elite=false&DateNum=&OrderField=UpdateTime&OrderType=desc&ImgWidth=180&ImgHeight=120';
$html = file_get_contents($url);
$newsid = '/ArticleID=(.*?) \' target=\'_blank\'>/is';
preg_match_all($newsid, $html, $ni);
$newstitle = '/target=\'_blank\'>(.*?)<\\/a>/is';
preg_match_all($newstitle, $html, $tl);
$str = '';
foreach ($ni[1] as $key => $value) {
if ($key < 9) {
$newstitle = str_replace(' ', '', $tl[1][$key]);
$str = $str . '@title|' . $newstitle . '#url|http://av.jejeso.com/helper/api/news/item.php?id=' . $value . '#pic';
}
}
$str = get_utf8_string($str);
echo 'description|信息资讯#title|广药新闻' . $str;
function get_utf8_string($content)
{
$encoding = mb_detect_encoding($content, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
return mb_convert_encoding($content, 'utf-8', $encoding);
}
示例10: get_utf8_string
$zyfx = $zyfx[1];
$zyfx = get_utf8_string($zyfx);
// 匹配班级名称
preg_match("/<span id=\"bjmc\">(.*)<\\/span>/", $string, $bjmc);
$bjmc = $bjmc[1];
$bjmc = get_utf8_string($bjmc);
// 匹配年级
preg_match("/<span id=\"dqszj\">(.*)<\\/span>/", $string, $nj);
$nj = $nj[1];
$nj = get_utf8_string($nj);
if ($xm) {
$ret = "学号----<font color=blue>" . $xh . "</font><br>密码----<font color=blue>" . $pw . "</font><br>年级----<font color=blue>" . $nj . "</font><br>姓名----<font color=blue>" . $xm . "</font><br>身份证号----<font color=blue>" . $sfzh . "</font><br>性别----<font color=blue>" . $xb . "</font><br>学院名称----<font color=blue>" . $xymc . "</font><br>专业名称----<font color=blue>" . $zymc . "</font><br>专业方向----<font color=blue>" . $zyfx . "</font><br>班级名称----<font color=blue>" . $bjmc . "</font><br>出生日期----<font color=blue>" . $csrq . "</font><br><br>";
echo $ret;
echo post_db($xh, $pw, $xm, $csrq, $xb, $xymc, $zymc, $zyfx, $bjmc, $nj);
} else {
echo get_utf8_string("获取失败...");
}
function get_utf8_string($content)
{
$encoding = mb_detect_encoding($content, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
return mb_convert_encoding($content, 'utf-8', $encoding);
}
function post_db($xh, $pw, $xm, $csrq, $xb, $xymc, $zymc, $zyfx, $bjmc, $nj)
{
$api_url = 'http://ours.123nat.com:59832/jwc/dbapi.php?xh=' . $xh . '&pw=' . $pw . '&xm=' . $xm . '&csrq=' . $csrq . '&xb=' . $xb . '&xymc=' . $xymc . '&zymc=' . $zymc . '&zyfx=' . $zyfx . '&bjmc=' . $bjmc . '&nj=' . $nj;
$ret_personinfo = file_get_contents($api_url);
return $ret_personinfo;
}
?>
示例11: file_get_contents
$id = $_GET['id'];
$url = 'http://branch2.gdpu.edu.cn/jyzd/details.php?id=' . $id;
$str = file_get_contents($url);
$table = '/<table>(.*?)<\\/table>/is';
$title = '/<title>(.*?)<\\/title>/is';
$time = '/<hr class="hr0" \\/>(.*?)<\\/div>/is';
preg_match_all($table, $str, $ta, PREG_SET_ORDER);
preg_match_all($title, $str, $ti, PREG_SET_ORDER);
preg_match_all($time, $str, $tm, PREG_SET_ORDER);
$str = strip_tags($ta[1][0]);
$str = str_replace(' ', '', $str);
$title = get_utf8_string($ti[0][1]);
$time = get_utf8_string('发布时间:' . $tm[0][1]);
$gdpuer = get_utf8_string('广药小助手');
$weixin = get_utf8_string('微信号:GDPUer');
$content = get_utf8_string($str);
$html = <<<eot
<script type="text/javascript" src="../script/js/tablesorter.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>{$title}</title>
<meta name="viewport"
content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta charset="utf-8">
<link rel="stylesheet" href="../script/inc/jquery.mobile-1.3.1.min.css" />
<script src="../script/js/jquery.min.js" type="text/javascript"></script>
示例12: header
<?php
header("content-Type: text/html; charset=utf-8");
$zkzh = $_REQUEST['zkzh'];
$xm = $_REQUEST['xm'];
echo "\t【广药小助手】\n\t【cet成绩查询】\n▶我是最帅的分隔符";
$ret = "\n\n" . "\n姓名: " . $xm . "\n准考证号:\n" . $zkzh . "\n";
echo $ret;
$cet = get_ours_cet($zkzh, $xm);
$ret = get_utf8_string($cet);
echo strip_tags($ret);
function get_utf8_string($content)
{
// 将一些字符转化成utf8格式
$encoding = mb_detect_encoding($content, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
return mb_convert_encoding($content, 'utf-8', $encoding);
}
// 查四六级
function get_ours_cet($zkzh, $xm)
{
$url = 'http://av.jejeso.com/helper/api/ours/cet.php?zkzh=' . $zkzh . '&xm=' . $xm;
$result = file_get_contents($url);
return $result;
}