Multiple Flags for json_encode()

后端 未结 2 2138
隐瞒了意图╮
隐瞒了意图╮ 2020-12-25 12:34

How do I use multiple flags for the php json_encode()-function?

json_encode($array, JSON_PRETTY_PRINT, JSON_UNESCAPED_UNICODE);

This doesn\

2条回答
  •  生来不讨喜
    2020-12-25 12:54

    Those flags are bitmasks. I wrote about it once a long time ago here on SO.

    So, basically, to use more than one option, you need to or them together

    json_encode($array, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
    

提交回复
热议问题