When to use PHP's json_encode function's second param ( the bitmasks )
PHP's json_encode function as a second optional 开发者_C百科param ( bitmasks ). Can someone explain to me what they're for and when I should use them and why?
Thanks
The purpose is to get rid of special character in the JSON output. In certain situation the special characters may have other meanings and you just want to pass the JSON through without making use of any of those.
Suppose you want to send the json inside some XML. You don't want any < in there messing with the xml. So you just use the option to get rid of those so it doesn't cause any problems.
精彩评论