转换阵列使用其他方法相比的JSON字符串 [英] Convert array to a string using other methods than JSON
本文介绍了转换阵列使用其他方法相比的JSON字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是PHP函数用于数组转换为字符串,除了使用JSON?
What is a function in PHP used to convert array to string, other than using JSON?
我知道有直接确实喜欢JSON的功能。我只是不记得了。
I know there is a function that directly does like JSON. I just don't remember.
推荐答案
连载()
是您正在寻找的功能。它会在一个特定的PHP内部格式返回其输入数组或对象的字符串重新presentation。字符串可以用改回原来的形式反序列化()
。
但要注意,不是所有的对象都是可序列化的,或者有些可能是只有部分序列化,无法与完全恢复反序列化()
。
But beware, that not all objects are serializable, or some may be only partially serializable and unable to be completely restored with unserialize()
.
$array = array(1,2,3,'foo');
echo serialize($array);
// Prints
a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;s:3:"foo";}
这篇关于转换阵列使用其他方法相比的JSON字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文