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

WBOY
Release: 2016-08-08 09:24:36
Original
1334 people have browsed it

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!