Home  >  Article  >  Backend Development  >  PHP writes array to file_PHP tutorial

PHP writes array to file_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:34:46875browse

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);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/508435.htmlTechArticlephp writes the array to the file php writes the array to the file, implemented through sequence and desequence. Please see the code $file=./data/file.cache;file_put_contents($file,serialize($array));//Write cache?...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn