PHP writes array to file_PHP tutorial

WBOY
Release: 2016-07-13 17:34:46
Original
906 people have browsed it

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?...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template