我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

PHP:将数组放入文件时在$ _POST元素之间添加逗号

The following is my code:

<?php
    #put the info the user just inputed into a file for later retrival
    file_put_contents("test.txt",$_POST, FILE_APPEND);
?>

And this is the result I get in test.txt:

JaneF16xyzWindows1215

How can I change the format of the result to be

Jane,F,16,xyz,Windows,12,15

(have commas between the elements)

Change it to

file_put_contents('test.txt', implode(',', $_POST), FILE_APPEND);

Note that this does not consider the possibility of array post values.

近期文章

  • 真正的多类继承,而不是通过特征的方法集合
  • 如何在php中使用html2pdf手动更改pdf的高度和宽度
  • 打印一个表,两列PHP关联数组作为三个并排的双列表
  • 如何在PHP中一次编辑多个值
  • 得到不。 PHP中某些值之间的数组元素?
  • 如何选择MYSQL datetime列到HTML输入日期时间
  • 在javascript中使用正则表达式翻译preg_replace .replace [关闭]
  • 日期函数中的第二个参数是什么意思?
  • PHP for loop optimization [关闭]
  • 如何使用和Yii [重复]
  • PHP中的数据标准?
  • 哪里不存在mysql
  • 在每张图片周围添加链接
  • 为double数组赋值
  • 用htaccess重写url?page = 2到/ page / 2?
  • 如何在属性值中添加php标签?
  • 从按天分组的MYSQL数据库中选择记录
  • 在PHP脚本中更改变量并再次运行函数,无需重新加载页面
  • PHP CI无法查看Post变量
  • 浮点数不能正确返回十进制值

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华