Home >Backend Development >PHP Tutorial >php将数组写入文件

php将数组写入文件

WBOY
WBOYOriginal
2016-06-23 13:45:311019browse

$str = '<?php return '."\n".var_export($data,true).';?>';$filename = 文件所在路径;$fp=fopen("$filename", "w+"); //打开文件指针,创建文件if(!is_writable($filename)){      die("文件:" .$filename. "不可写,请检查!");}file_put_contents($filename,$str);

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