Home >Backend Development >PHP Tutorial >For php and js, a summary of references to variables in json file format

For php and js, a summary of references to variables in json file format

WBOY
WBOYOriginal
2016-08-08 09:24:361371browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php—Smarty-Cache 2 (26)Next article:php—Smarty-Cache 2 (26)