1.file_put_contents()函数,可以写入string,array或者stream 资源,但是,array不可以是多维数组。
2.那如何写入多维数组?
采用的方法:json华数据格式(json_decode/json_encode函数 只能处理utf-8编码的数据)
(1)$content = json_encode($arr,JSON_UNESCAPED_UNICODE);(这个参数可以转义为 \u开头的UNICODE数据)
(2) file_put_content($filename,$content);
(3)json_decode(file_get_content($filename),true); 注:为true时,返回array而不是object。