//php curl实例代码如下:
session_write_close();
$pageurl = "http://www.phprm.com/index.html";
curl_setopt($ch, curlopt_returntransfer, 1);
curl_setopt ($ch, curlopt_url, $pageurl );
$html = curl_exec ( $ch );
curl_close($ch);
//then you need to fix pathing to absolute
$search = "/(src|href|background)="[^:,^>,^"]*"/i";
preg_match_all ( $search, $html, $a_matches );
//php fopen实例,代码如下:
$file = fopen("http://www.phprm.com/","r"); //读取远程文件
$file = fopen("a.txt","r");//读取本地文件
//php file_get_contents
$homepage = file_get_contents('http://www.phprm.com/'); //读取远程文本
echo $homepage;
:
// <= php 5
$file = file_get_contents('./people.txt', true);
// > php 5
$file = file_get_contents('./people.txt', file_use_include_path); //打开本地文本本文地址:
转载随意,但请附上文章地址:-)
本书详细说明了PHP的使用方法,内容涉及PHP应用的各个方面,并提供了大量的代码实例,使读者能够快速而容易地学会PHP。每一章都分为两部分,前一部分“深入分析”详细说明相关的技术信息,
385
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号