Parsing Javascript (not JSON) in PHP

后端 未结 5 1598
[愿得一人]
[愿得一人] 2020-12-01 11:06

I have a php string containing the serialization of a javascript object :

$string = \'{fu:\"bar\",baz:[\"bat\"]}\';

The actual string is fa

5条回答
  •  半阙折子戏
    2020-12-01 11:36

    I found out that the Yii-framework's CJSON::decode() function handles Javascript objects as well.

    If you're not using Yii, you should be able to just use the source code

提交回复
热议问题