首页 / PHP / php的iconv编码转换问题!
php的iconv编码转换问题!
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php的iconv编码转换问题!,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含8006字,纯文字阅读大概需要12分钟。
内容图文
![php的iconv编码转换问题!](/upload/InfoBanner/zyjiaocheng/236/fd9898397dc14ea7b158a9b583f12a5d.jpg)
public function file_get(){
$file = file_get_contents('Curl.html');
iconv("ANSI", "UTF-8//IGNORE", $file);
return empty($file) ? null : $file;
}
}
header("Content-type: text/html; charset=utf-8");
$url = new mycurl();
$file = $url->file_get();
echo strip_tags($file);
Curl.html如下:
输出如下:(乱码!)
Notice: iconv(): Wrong charset, conversion from `ANSI' to `UTF-8//IGNORE' is not allowed in D:\xampp\htdocs\function\function\cURL\curl5.php on line 34
HTTP/1.1 200 OK Date: Mon, 03 Feb 2014 12:00:13 GMT Server: ATS/3.2.4 X-Powered-By: PHP/5.3.9 Vary: Accept-Encoding Content-Type: text/html Age: 0 Transfer-Encoding: chunked Proxy-Connection: keep-alive Via: http/1.1 nxats01.ehomenet.com (ApacheTrafficServer/3.2.4 [cMsSf ]) ????????й??????? a {color:#333;text-decoration:none;} a:hover, a:active, a:focus{color:#f00;text-decoration:underline;} img{border:0} body{margin:0px;font:12px "????";background:url(http://static.sporttery.cn/info/roll/images/TopBg-ZQ.png) no-repeat;background-position:top center} .footer{width:1000px;line-height:22px;text-align:center;font-size:12px;color:#000000;margin-top:15px;} .wrap{width:1000px;margin:auto;} .Main{width:998px;border-left:1px #EEEEEE solid;border-right:1px #EEEEEE solid;background:url(http://static.sporttery.cn/info/roll/images/MainBg.gif) repeat-x;background-position:top;float:left} .MainLeftBox{width:686px;margin-left:11px;display:inline;float:left} .MainRightBox{float:right;width:269px;margin:-30px 7px 0 0;} .Two_dot{width:686px;height:1px;background:#EBEBEB} .YourPosition{color:#333333;margin:6px 0 0 8px;height:24px} .YourPosition a{color:#333333;} .YourPosition a:hover{color:#FF0000;} .dot{background:url(http://static.sporttery.cn/info/roll/images/2_dot2.gif) repeat-x;width:686px;} /*Banner1*/ .Banner{position:absolute;margin:1394px 0 0 6px;border:1px #000000 solid} /*Banner2*/ .banner2{width:984px;height:88px;position:absolute;margin:2320px 0 0 6px;border:1px #006086 solid} *{font-size:12px;line-height:1.5em;} .wrap{width:100%} .banner,.footer,#main_nav,.crumb form,.titleSc,.hideforprint{display:none;} .crumb *{display:none;} .crumb{text-align:left;font-weight:bold;line-height:26px; } table{width:100%; } table{border-collapse:collapse;} table th,table td{border:1px solid #333;font-size:12px;;line-height:1.2em;padding:2px;width:auto; } ???????01-29 15:43 [???] ?й??????? >> ??????? ???????? | ??????? ????????????1?????????????????????????????????????籭????????????????????????????????????????????????????????????????????????????????????? ? ??????????????δ??????????????????????????????????????????淨??桱?? ???????? ???????? ???±?? ???? ???? VS ??? ???????????? ??????? ?????? ??? ?????? ???????? ????002?1?????????????? VS ????????2014-01-30 02:59 ?????????003?????????????????????? VS ????????2014-01-30 02:59 ?????????008??????????????????????? VS ????????2014-01-30 03:44 ?????????009????????????? VS ?????2014-01-30 03:44 ???????????? ???018?????????????????????? VS ?3?????2014-01-29 03:44 ????????????? ????001??????????????? VS ????л??2014-01-30 01:59 ?????????004????????????л??????? VS ??????2014-01-30 03:29 ?????????005?????????????????? VS ??п??2014-01-30 03:44 ?????????006????????????????????? VS ??????????2014-01-30 03:44 ?????????007??????????????ж??? VS ???????2014-01-30 03:44 ?????????010????????????????????? VS ?????????2014-01-30 03:44 ?????δ????: ????????,????????????011????????????????? VS ?????2014-01-30 03:44 ?????????012???????????????????? VS ??????2014-01-30 04:59 ?????δ????: ????????,????????????013?????????????? VS ????????2014-01-30 07:59 ?????????014????????????????? VS ?????????2014-01-30 07:59 ????????????? ????001???????????????????? VS ???????2014-01-31 03:44 ?????????002??????????????????? VS ??????2014-01-31 03:59 ?????????003????????????????? VS ???????????2014-01-31 06:59 ?????????004????????????????? VS ????2014-01-31 09:14 ????? ? ??????????????δ??????????????????????????????????????????淨??桱?? match_counts('19');
回复内容:
public function file_get(){
$file = file_get_contents('Curl.html');
iconv("ANSI", "UTF-8//IGNORE", $file);
return empty($file) ? null : $file;
}
}
header("Content-type: text/html; charset=utf-8");
$url = new mycurl();
$file = $url->file_get();
echo strip_tags($file);
Curl.html如下:
输出如下:(乱码!)
Notice: iconv(): Wrong charset, conversion from `ANSI' to `UTF-8//IGNORE' is not allowed in D:\xampp\htdocs\function\function\cURL\curl5.php on line 34
HTTP/1.1 200 OK Date: Mon, 03 Feb 2014 12:00:13 GMT Server: ATS/3.2.4 X-Powered-By: PHP/5.3.9 Vary: Accept-Encoding Content-Type: text/html Age: 0 Transfer-Encoding: chunked Proxy-Connection: keep-alive Via: http/1.1 nxats01.ehomenet.com (ApacheTrafficServer/3.2.4 [cMsSf ]) ????????й??????? a {color:#333;text-decoration:none;} a:hover, a:active, a:focus{color:#f00;text-decoration:underline;} img{border:0} body{margin:0px;font:12px "????";background:url(http://static.sporttery.cn/info/roll/images/TopBg-ZQ.png) no-repeat;background-position:top center} .footer{width:1000px;line-height:22px;text-align:center;font-size:12px;color:#000000;margin-top:15px;} .wrap{width:1000px;margin:auto;} .Main{width:998px;border-left:1px #EEEEEE solid;border-right:1px #EEEEEE solid;background:url(http://static.sporttery.cn/info/roll/images/MainBg.gif) repeat-x;background-position:top;float:left} .MainLeftBox{width:686px;margin-left:11px;display:inline;float:left} .MainRightBox{float:right;width:269px;margin:-30px 7px 0 0;} .Two_dot{width:686px;height:1px;background:#EBEBEB} .YourPosition{color:#333333;margin:6px 0 0 8px;height:24px} .YourPosition a{color:#333333;} .YourPosition a:hover{color:#FF0000;} .dot{background:url(http://static.sporttery.cn/info/roll/images/2_dot2.gif) repeat-x;width:686px;} /*Banner1*/ .Banner{position:absolute;margin:1394px 0 0 6px;border:1px #000000 solid} /*Banner2*/ .banner2{width:984px;height:88px;position:absolute;margin:2320px 0 0 6px;border:1px #006086 solid} *{font-size:12px;line-height:1.5em;} .wrap{width:100%} .banner,.footer,#main_nav,.crumb form,.titleSc,.hideforprint{display:none;} .crumb *{display:none;} .crumb{text-align:left;font-weight:bold;line-height:26px; } table{width:100%; } table{border-collapse:collapse;} table th,table td{border:1px solid #333;font-size:12px;;line-height:1.2em;padding:2px;width:auto; } ???????01-29 15:43 [???] ?й??????? >> ??????? ???????? | ??????? ????????????1?????????????????????????????????????籭????????????????????????????????????????????????????????????????????????????????????? ? ??????????????δ??????????????????????????????????????????淨??桱?? ???????? ???????? ???±?? ???? ???? VS ??? ???????????? ??????? ?????? ??? ?????? ???????? ????002?1?????????????? VS ????????2014-01-30 02:59 ?????????003?????????????????????? VS ????????2014-01-30 02:59 ?????????008??????????????????????? VS ????????2014-01-30 03:44 ?????????009????????????? VS ?????2014-01-30 03:44 ???????????? ???018?????????????????????? VS ?3?????2014-01-29 03:44 ????????????? ????001??????????????? VS ????л??2014-01-30 01:59 ?????????004????????????л??????? VS ??????2014-01-30 03:29 ?????????005?????????????????? VS ??п??2014-01-30 03:44 ?????????006????????????????????? VS ??????????2014-01-30 03:44 ?????????007??????????????ж??? VS ???????2014-01-30 03:44 ?????????010????????????????????? VS ?????????2014-01-30 03:44 ?????δ????: ????????,????????????011????????????????? VS ?????2014-01-30 03:44 ?????????012???????????????????? VS ??????2014-01-30 04:59 ?????δ????: ????????,????????????013?????????????? VS ????????2014-01-30 07:59 ?????????014????????????????? VS ?????????2014-01-30 07:59 ????????????? ????001???????????????????? VS ???????2014-01-31 03:44 ?????????002??????????????????? VS ??????2014-01-31 03:59 ?????????003????????????????? VS ???????????2014-01-31 06:59 ?????????004????????????????? VS ????2014-01-31 09:14 ????? ? ??????????????δ??????????????????????????????????????????淨??桱?? match_counts('19');
$file = iconv("gbk", "UTF-8//IGNORE", $file);
这样就OK了。
内容总结
以上是互联网集市为您收集整理的php的iconv编码转换问题!全部内容,希望文章能够帮你解决php的iconv编码转换问题!所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。