时间:2021-07-01 10:21:17 帮助过:5人阅读
php把数组写入文件,通过序列和反序列实现。请看代码$file="./data/file.cache";file_put_contents($file,serialize($array));//写入缓存
$file="./data/file.cache";
$array = array("count" => "3000",
"num" =>"300");
//缓存
file_put_contents($file,serialize($array));//写入缓存
?>
$file="./data/file.cache";
$handle = fopen($file, "r");
$cacheArray = unserialize(fread($handle, filesize ($file)));
print_r($cacheArray);
?>
http://www.bkjia.com/PHPjc/508435.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/508435.htmlTechArticlephp把数组写入文件 php把数组写入文件,通过序列和反序列实现。请看代码$file=./data/file.cache;file_put_contents($file,serialize($array));//写入缓存 ?...