数组到字符串 PHP? [英] Array to String PHP?
本文介绍了数组到字符串 PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将 PHP 数组转换为字符串的最佳方法是什么?
我有一个变量 $type
,它是一个类型数组.
What is the best method for converting a PHP array into a string?
I have the variable $type
which is an array of types.
$type = $_POST[type];
我想将它作为单个字符串存储在我的数据库中,每个条目用 |
分隔:
I want to store it as a single string in my database with each entry separated by |
:
体育|节日|其他
推荐答案
使用 implode
implode("|",$type);
这篇关于数组到字符串 PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文