php的iconv编码转换问题!
<code> 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); </code>
Curl.html如下:
输出如下:(乱码!)
<code>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 [ˢ��] �й������� >> ��ע���� �������� | ȫ������ �����������¹��������������������ϻᱭ��������߱����籭Ԥѡ���ո�����������������������������������������Ӣ������������Ӣ�����ھ�����Ӣ���������� ע ����ҳ����ʾ����δ����������Ϣ���鿴���������������ع̶�����ʤƽ���淨ҳ�桱�� �������� ȫ������Ͷ ���±�� ���� ���� VS �Ͷ� Ԥ�ƽ�ֹ����ʱ�� ������Ѷ ����״̬ ��ע �ر���ʾ �������� ����002�¹�������˹ͼ���� VS ����Ľ���2014-01-30 02:59 �ѿ�������003�������������϶��Ͷ����� VS �����ᄎ��2014-01-30 02:59 �ѿ�������008Ӣ������������������ķ�ȴ� VS ����˹�س�2014-01-30 03:44 �ѿ�������009��������Dz���˹ VS �����2014-01-30 03:44 �ѿ����ܶ����� �ܶ�018Ӣ�����������ƶ���˹���� VS ʲ³˹����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'); </code>
回复内容:
<code> 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); </code>
Curl.html如下:
输出如下:(乱码!)
<code>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 [ˢ��] �й������� >> ��ע���� �������� | ȫ������ �����������¹��������������������ϻᱭ��������߱����籭Ԥѡ���ո�����������������������������������������Ӣ������������Ӣ�����ھ�����Ӣ���������� ע ����ҳ����ʾ����δ����������Ϣ���鿴���������������ع̶�����ʤƽ���淨ҳ�桱�� �������� ȫ������Ͷ ���±�� ���� ���� VS �Ͷ� Ԥ�ƽ�ֹ����ʱ�� ������Ѷ ����״̬ ��ע �ر���ʾ �������� ����002�¹�������˹ͼ���� VS ����Ľ���2014-01-30 02:59 �ѿ�������003�������������϶��Ͷ����� VS �����ᄎ��2014-01-30 02:59 �ѿ�������008Ӣ������������������ķ�ȴ� VS ����˹�س�2014-01-30 03:44 �ѿ�������009��������Dz���˹ VS �����2014-01-30 03:44 �ѿ����ܶ����� �ܶ�018Ӣ�����������ƶ���˹���� VS ʲ³˹����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'); </code>
$file = iconv("gbk", "UTF-8//IGNORE", $file);
这样就OK了。

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

PHP 8.4 带来了多项新功能、安全性改进和性能改进,同时弃用和删除了大量功能。 本指南介绍了如何在 Ubuntu、Debian 或其衍生版本上安装 PHP 8.4 或升级到 PHP 8.4

Visual Studio Code,也称为 VS Code,是一个免费的源代码编辑器 - 或集成开发环境 (IDE) - 可用于所有主要操作系统。 VS Code 拥有针对多种编程语言的大量扩展,可以轻松编写

如果您是一位经验丰富的 PHP 开发人员,您可能会感觉您已经在那里并且已经完成了。您已经开发了大量的应用程序,调试了数百万行代码,并调整了一堆脚本来实现操作

本教程演示了如何使用PHP有效地处理XML文档。 XML(可扩展的标记语言)是一种用于人类可读性和机器解析的多功能文本标记语言。它通常用于数据存储

JWT是一种基于JSON的开放标准,用于在各方之间安全地传输信息,主要用于身份验证和信息交换。1.JWT由Header、Payload和Signature三部分组成。2.JWT的工作原理包括生成JWT、验证JWT和解析Payload三个步骤。3.在PHP中使用JWT进行身份验证时,可以生成和验证JWT,并在高级用法中包含用户角色和权限信息。4.常见错误包括签名验证失败、令牌过期和Payload过大,调试技巧包括使用调试工具和日志记录。5.性能优化和最佳实践包括使用合适的签名算法、合理设置有效期、

字符串是由字符组成的序列,包括字母、数字和符号。本教程将学习如何使用不同的方法在PHP中计算给定字符串中元音的数量。英语中的元音是a、e、i、o、u,它们可以是大写或小写。 什么是元音? 元音是代表特定语音的字母字符。英语中共有五个元音,包括大写和小写: a, e, i, o, u 示例 1 输入:字符串 = "Tutorialspoint" 输出:6 解释 字符串 "Tutorialspoint" 中的元音是 u、o、i、a、o、i。总共有 6 个元

静态绑定(static::)在PHP中实现晚期静态绑定(LSB),允许在静态上下文中引用调用类而非定义类。1)解析过程在运行时进行,2)在继承关系中向上查找调用类,3)可能带来性能开销。

PHP的魔法方法有哪些?PHP的魔法方法包括:1.\_\_construct,用于初始化对象;2.\_\_destruct,用于清理资源;3.\_\_call,处理不存在的方法调用;4.\_\_get,实现动态属性访问;5.\_\_set,实现动态属性设置。这些方法在特定情况下自动调用,提升代码的灵活性和效率。
