axgle点评:简单的一个函数,让你时刻了解php的飞速发展---若您密切关注php的发展的话~~~~
5.file_get_contents() (注:PHP 4 >= 4.3.0, PHP 5)
将整个文件读入一个字符串.file_get_contents() 函数是用来将文件的内容读入到一个字符串中的首选方法。如果操作系统支持还会使用内存映射技术来增强性能。
例如:
<?php
$data = file_get_contents('test.txt');
echo $data;
?>
6. file_put_contents (注:PHP 5)
将一个字符串直接写入文件.
例如:
<?php
//某图象的地址
$url="http://...test.com/plmm.jpg";
//读取二进制“字符串”
$data=file_get_contents($url);
//保存到自己的电脑里
file_put_contents("美女.jpg",$data);
?>
axgle点评:若您发现某个美女图片网站的图片命名是诸如1.jpg,2.jpg...
ok,用一个for循环,把所有的“美女”抓下来吧,不要因此太兴奋让您的女朋友
吃醋了哈~~~
7.function_exists
若函数存在,则返回true
例如:
<?php
//若该函数不存在,则自定义该函数
if(!function_exists('file_put_contents')) {
function file_put_contents($filename,$data) {
$fp=fopen($filename,"wb");
fwrite($fp,$data);
fclose($fp);
}
}
?>
8.get_defined_functions
返回一个数组,得到所有已定义的php函数。
|
||
相关热词搜索: |
||
收藏到网摘: | ||
|