Most efficient way to pass PHP variables to external JavaScript (or jQuery) file

后端 未结 2 579
温柔的废话
温柔的废话 2021-01-13 07:16

I\'ve read several posts about the question and found this to be the simplest solution, here is my code:

js inside PHP code



        
2条回答
  •  礼貌的吻别
    2021-01-13 07:52

    Pretty sure that won't break it. The whole point of json_encode is that it's safe to dump.

    might break it, but PHP escapes / as \/ by default so you shouldn't have to worry about it.

提交回复
热议问题