Home > Article > Backend Development > PHP writes array to file_PHP tutorial
php writes array to file
php writes the array to the file through sequence and desequence. Please see the code $file="./data/file.cache";file_put_contents($file,serialize($array));//Write cache
$file="./data/file.cache";
$array = array("count" => "3000",
"num" =>"300");
//Cache
file_put_contents($file,serialize($array));//Write cache
?>
$file="./data/file.cache";
$handle = fopen($file, "r");
$cacheArray = unserialize(fread($handle, filesize ($file)));
print_r($cacheArray);
?>