php操作服务器文件系统中的文件内容

<?php

//file_get_contents()函数读取服务器文件系统的文件内容

$counter = file_get_contents('cont.text');   //参数为指定要读取哪个文件,要读取文件的文件路径

//intval()函数转整数

$counter = intval($counter);

$counter++;

//file_put_contents()函数将内容写入服务器文件系统的文件中

file_put_contents('cont.text',$counter);    //参数两个,第一个为要写入哪个文件,要写入文件的文件路径

猜你喜欢

转载自blog.csdn.net/FarmerXiaoYi/article/details/77170706
今日推荐