Home >Backend Development >PHP Tutorial >For php and js, a summary of references to variables in json file format
1. For php files, when introducing variables within double quotes, you need to add {variable name};
.variable name or .variable name .;
$a ="gegweg{$demo};
$a ="gegweg".$demo;
$a ="gegweg".$demo." fweffwef";
2. For the js file, add the + number,
Var demo;
Alert("gegwg"+demo);/ For the json format, you only need to add the variable name after the key value:
3, Vardemo="nike";
var txt ='{"employees": [' +
'{"firstName":"Bill","lastName":demo},' +
'{"firstName":"George","lastName":},' +
'{"firstName":"Thomas","lastName":"Carter"}]}';
4. For double quotes in front, you can use the plus sign to solve:
var random = Math.ceil(Math. random()*10000000);
alert(random);
var data = '{"msg":{"head":{"random":"'+random+'"}, " body":[{"type":0, "content":{"text":"Hello, how can I help you"}}]}}';
The above introduces the reference summary of variables in php, js, and json file formats, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.