Unserialize PHP Array in Javascript

后端 未结 4 1549
灰色年华
灰色年华 2020-11-27 23:44

I have a table with a load of rows of serialized arrays that I plan to request and pass it to JavaScript.

The problem is - is it possible to unser

4条回答
  •  旧巷少年郎
    2020-11-28 00:02

    Php.js has javascript implementations of unserialize and serialize:

    http://phpjs.org/functions/unserialize/

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

    That said, it's probably more efficient to convert to JSON on the server side. JSON.parse is going to be a lot faster than PHP.js's unserialize.

提交回复
热议问题