数组字符串PHP? [英] Array to String PHP?
本文介绍了数组字符串PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是转换一个PHP数组转换成字符串的最好方法?结果
我有变量 $类型
这类型的数组。
$型= $ _ POST [类型];
我想把它保存为我的数据库一个字符串与分隔每个条目|
:
体育|节日|其他
块引用>解决方案只需使用破灭
破灭(|,$型);
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
|
:Sports|Festivals|Other
解决方案Simply use implode
implode("|",$type);
这篇关于数组字符串PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文