Escaping escape Characters

前端 未结 6 1307
悲哀的现实
悲哀的现实 2020-12-31 17:41

I\'m trying to mimic the json_encode bitmask flags implemented in PHP 5.3.0, here is the string I have:

$s = addslashes(\'O\\\'Rei\"lly\'); // O         


        
6条回答
  •  余生分开走
    2020-12-31 18:03

    It's escaping the backslash as well as the quote. It's difficult dealing with escaped escapes, as you're doing here, as it quickly turns into backslash counting games. :-/

提交回复
热议问题