开发者

javascript alternative to php seralize

开发者 https://www.devze.com 2023-02-14 08:50 出处:网络
hello I have a javascript array and 开发者_运维问答I would like to use a function for javascript that will take my array and serialize it.

hello I have a javascript array and 开发者_运维问答I would like to use a function for javascript that will take my array and serialize it.

Thanks


The best (native) way to serialize objects in Javascript is JSON; newer browsers support JSON natively, for other browsers a script can be included: https://github.com/douglascrockford/JSON-js

On the PHP side, there is json_decode function that can be used to deserialize JSON.


The native PHP function has been ported to Javascript as well in the php.js library:

http://phpjs.org/functions/serialize:508

0

精彩评论

暂无评论...
验证码 换一张
取 消