奇怪的fopen问题,在线寻求答案,立刻结贴 fopen以后print_r(stream_get_meta_data($htmlfp));看看 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 蛮有意思的。 $filepath = "http://www.baidu.cn"; $filepath = trim ($filepath); $htmlfp = fopen( "'$filepath'" , 'r'); //试试这样,我这里没有环境,没法调。 if (strstr ($filepath, '://')) { while ($data = @fread ($htmlfp, 500000)) { $string .= $data; } } echo $string; <?php$string = '';$filepath = 'http://www.baidu.cn'; $filepath = ( ereg( 'http://', trim($filepath ) ) ? $filepath : 'http://'.$filepath ); //最好正则一下前7位是否是http://$htmlfp = fopen( $filepath, 'r' ); while ( !feof( $htmlfp ) ):echo fgets( $htmlfp, 128 ); //一边get一边输出,这样速度快。endwhile;fclose($htmlfp); //最后别忘记关闭文件。?>PHP5.25测试OK! 把最上面的$string = '';去掉,我忘记删了/ mysql数据超过30M大,怎么还源 高手进来 怎么调用指定的打印机 我公司的技术总监给介绍了个对象,要求见面,怎么办? 关于php数组的问题 在一个输入框输入信息后如何把javascript语句去掉,但不去掉别的html语句 对于用户通过表单提交的数据要做那些安全转换? error_reporting()返回的int代表什么? 求多张关联表的SQL语句 大佬,Redis如何删除一个GEO地理位置数据??? 请教php为什么捕获不到mysql的异常? 请教:require('''../../a.php")引用上一级的上一级下文件出错?
$filepath = "http://www.baidu.cn";
$filepath = trim ($filepath);
$htmlfp = fopen( "'$filepath'" , 'r'); //试试这样,我这里没有环境,没法调。
if (strstr ($filepath, '://'))
{
while ($data = @fread ($htmlfp, 500000))
{
$string .= $data;
}
}
echo $string;
<?php
$string = '';
$filepath = 'http://www.baidu.cn';
$filepath = ( ereg( 'http://', trim($filepath ) ) ? $filepath : 'http://'.$filepath ); //最好正则一下前7位是否是http://$htmlfp = fopen( $filepath, 'r' ); while ( !feof( $htmlfp ) ):
echo fgets( $htmlfp, 128 ); //一边get一边输出,这样速度快。
endwhile;fclose($htmlfp); //最后别忘记关闭文件。
?>PHP5.25测试OK!