php 追加内容到txt文件中
覆盖txt文件内容:
1 2 3 4 |
$filename = "aa/a.txt" ;
$handle = fopen ( $filename , "w" );
$str =fwrite( $handle , "test" );
fclose( $handle );
|
效果:
testtesttesttesttesttesttest
追加内容到txt:
1 2 3 4 |
$filename = "aa/a.txt" ;
$handle = fopen ( $filename , "a+" );
$str =fwrite( $handle , "test
" );
fclose( $handle );
|
效果:
test
test
test
test
test
test
test
$lines=file("db.txt"); foreach ($lines as $value) { $line=explode(",",$value); echo "no1:$line[0]--no2:$line[1]---time:$line[2]-<br>"; }
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇: js判断判断当前域名
- 下一篇: mysql 中sum (if())