我们知道,在
PHP写入文件判断是否能被写:
< ?php
能写了的话可以使用file_put_contents函数实现PHP写入文件:
- < ?php
- $file = 'dirlist.php';
- if (is_writable($file) == false) {
- die('我是鸡毛,我不能');
- }
- $data = '我是可鄙,我想要';
- file_put_contents ($file, $data);
- ?>
file_put_contents函数在php5中新引进的函数(不知道存在的话用function_exists函数先判断一下)低版本的php无法使用,可以使用如下方式实现PHP写入文件:
- $f = fopen($file, 'w');
- fwrite($f, $data);
- fclose($f);
已抢186360个
抢已抢67219个
抢已抢352851个
抢已抢666940个
抢已抢121881个
抢已抢22889个
抢