php用file_get_contents读取文件问题 在一个PHP文件中用file_get_contents读取一个静态的HTML文件,然后用ECHO显示出来,但显示出来时会自动在最前面加了个空格,但查看HTML源代码时,又找不到这个空格。为什么?哪位高人指点一二 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.biuuu.com/p819.html这个人的问题和我的情况很像,php赋值会产生额外的输出吗?应该怎么解决? iconv("gb2312","UTF-8",$content);用法错误,反过来iconv("UTF-8","gb2312",$content); 1.file_get_contentsPHP代码 1. <?php 2. $url = http://www.xxx.com/; 3. $contents = file_get_contents($url); 4. //如果出现中文乱码使用下面代码 5. //$getcontent = iconv("gb2312", "utf-8",file_get_contents($url)); 6. //echo $getcontent; 7. echo $contents; 8. ?> 2.curlPHP代码 1. <?php 2. $url = "http://www.xxx.com/"; 3. $ch = curl_init(); 4. $timeout = 5; 5. curl_setopt($ch, CURLOPT_URL, $url); 6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 7. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); 8. //在需要用户检测的网页里需要增加下面两行 9. //curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); 10. //curl_setopt($ch, CURLOPT_USERPWD, US_NAME.":".US_PWD); 11. $contents = curl_exec($ch); 12. curl_close($ch); 13. echo $contents; 14. ?>3.fopen->fread->fclosePHP代码 1. <?php 2. $handle = fopen ("http://www.xxx.com/", "rb"); 3. $contents = ""; 4. do { 5. $data = fread($handle, 8192); 6. if (strlen($data) == 0) { 7. break; 8. } 9. $contents .= $data; 10. } while(true); 11. fclose ($handle); 12. echo $contents; 13. ?> flash sendandload 获取 php 返回 php 已经把页面成功抓取到,但是查看源代码内容,有些内容却不显示 请问php中上传文件后,如何取得原文件的路径啊? 关于curl的一个参数。 如何刷新php 验证码 简单问题 新手问题~~~~~~急~~~ 满分求php3des加密的问题 兼容JAVA 求助:PHP变量能传递读不出来? 江湖救急!画图问题:加载2个画图页面,Apche就会出错??!! 布置网页问题 PHP 二维数组 输出的问题
iconv("UTF-8","gb2312",$content);
PHP代码 1. <?php
2. $url = http://www.xxx.com/;
3. $contents = file_get_contents($url);
4. //如果出现中文乱码使用下面代码
5. //$getcontent = iconv("gb2312", "utf-8",file_get_contents($url));
6. //echo $getcontent;
7. echo $contents;
8. ?> 2.curl
PHP代码 1. <?php
2. $url = "http://www.xxx.com/";
3. $ch = curl_init();
4. $timeout = 5;
5. curl_setopt($ch, CURLOPT_URL, $url);
6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
7. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
8. //在需要用户检测的网页里需要增加下面两行
9. //curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
10. //curl_setopt($ch, CURLOPT_USERPWD, US_NAME.":".US_PWD);
11. $contents = curl_exec($ch);
12. curl_close($ch);
13. echo $contents;
14. ?>3.fopen->fread->fclose
PHP代码 1. <?php
2. $handle = fopen ("http://www.xxx.com/", "rb");
3. $contents = "";
4. do {
5. $data = fread($handle, 8192);
6. if (strlen($data) == 0) {
7. break;
8. }
9. $contents .= $data;
10. } while(true);
11. fclose ($handle);
12. echo $contents;
13. ?>