读取文件并追加内容:
$file = 'people.txt'
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
$current .= "John Smith\n"
// Write the contents back to the file
file_put_contents($file, $current);
将数组输出到文件中:
//将 var_export()的第二个参数值设置为TRUE时,会将解析值返回而不是直接输出
file_put_contents(FILENAME, var_export($array, true));