Passing PHP JSON to [removed] echo json_encode vs echo json declaration

后端 未结 9 2271
猫巷女王i
猫巷女王i 2021-01-05 01:52

I\'m trying to create a common constants file to share between php and javascript, using JSON to store the constants. But I\'m wondering why pass the JSON from PHP to javasc

9条回答
  •  我在风中等你
    2021-01-05 01:54

    In your case $json_obj is already a string. So it is not necessary. But if you have an array you want to pass to javascript json_encode will help you with this.

提交回复
热议问题