Home > Backend Development > PHP Tutorial > php将数组或字符串写入文件

php将数组或字符串写入文件

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:47:35
Original
940 people have browsed it

//将数组保存在文件中function export_to_file($file, $variable) {    $fopen = fopen($file, 'wb');    if (!$fopen) {        return false;    }    fwrite($fopen, "<?php \nreturn ".var_export($variable, true).";");    fclose($fopen);    return true;}//将字符串写入文件function put_to_file($file, $content) {    $fopen = fopen($file, 'wb');    if (!$fopen) {        return false;    }    fwrite($fopen, $content);    fclose($fopen);    return true;}
Copy after login

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