码迷,mamicode.com
首页 > Web开发 > 详细

18.有一个网页地址, 比如PHP开发资源网主页: http://www.phpres.com/index.html,如何得到它的内容?

时间:2016-06-28 08:09:44      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:

方法1(对于PHP5及更高版本):

    $readcontents = fopen("http://www.phpres.com/index.html", "rb");

    $contents = stream_get_contents($readcontents);

    fclose($readcontents);

    echo $contents;

    方法2:

    echo file_get_contents("http://www.phpres.com/index.html");

18.有一个网页地址, 比如PHP开发资源网主页: http://www.phpres.com/index.html,如何得到它的内容?

标签:

原文地址:http://www.cnblogs.com/xiaorui123/p/5622123.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!