Why use CJSON encode when we have json_encode

后端 未结 4 403
不思量自难忘°
不思量自难忘° 2021-01-01 09:33

I am building an API for a website using Yii. I know that there is a utility class called CJson and has a function called encode.

As far as I know there are addition

4条回答
  •  Happy的楠姐
    2021-01-01 10:23

    I realise this is an old topic, but wanted to add another reason.

    By doing all JSON encoding through a helper class like CJSON you can override default behavior. For example you can use it to add a token to prevent JSON hijacking.

提交回复
热议问题