PHP:将数组放入文件时,在$\u POST元素之间添加逗号
以下是我的代码:PHP:将数组放入文件时,在$\u POST元素之间添加逗号,php,arrays,post,Php,Arrays,Post,以下是我的代码: <?php #put the info the user just inputed into a file for later retrival file_put_contents("test.txt",$_POST, FILE_APPEND); ?> 这是我在test.txt中得到的结果: JaneF16xyzWindows1215 如何将结果的格式更改为 简,F,16,xyz,Windows,12,15 (元素之间有逗号)将其更改为 fil
<?php
#put the info the user just inputed into a file for later retrival
file_put_contents("test.txt",$_POST, FILE_APPEND);
?>
这是我在test.txt中得到的结果:
JaneF16xyzWindows1215
如何将结果的格式更改为
简,F,16,xyz,Windows,12,15
(元素之间有逗号)将其更改为
file_put_contents('test.txt', implode(',', $_POST), FILE_APPEND);
注意,这并不考虑数组后值的可能性。
< P>将其改为file_put_contents('test.txt', implode(',', $_POST), FILE_APPEND);
注意,这不考虑数组POST值的可能性。