PHP json_encode and javascript functions

后端 未结 9 1406
别跟我提以往
别跟我提以往 2020-12-06 04:28

I need to encode a javascript function into a JSON object in PHP.

This:

$function = \"function(){}\";
$message = \"Hello\";

$json = array(   
               


        
9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 04:53

    The enconding part in PHP is seems to be solved by now. You can use

    json_encode($p, JSON_UNESCAPED_UNICODE)

    this way your function will not be escaped. However

提交回复
热议问题