Using Json to realize data exchange between PHP and JavaScript

time:15-11-16 forum:PHP tools and code
  http://www.nowamagic.net/php/php_UseJsonPassData.php

JSON (JavaScript) is a lightweight data interchange format.

Jane, either XML or JSON, is a transfer station to facilitate the interaction of data between the client and the server side, especially for object type data, such as the most common array.

will send the array from PHP to JavaScript, and send the array from JavaScript to the PHP example, the example is simple and the concept can be understood. No matter from PHP to JavaScript or JavaScript to PHP, JSON will flatten the object to be a string before transmitting.
PHP passes to JavaScript value

PHP file json.php
[code].Lt;? Php
$arr = array. 'http://www.nowamagic.net',
)
;
$json_string = json_encode ($arr);
echo.Quot; getProfile ($json_string); .quot; nick.quot;.Quot; Gonn.quot;.Quot; contact.quot; {.quot; email.quot;.Quot; gonnsai@163.com.quot;.Quot; website.quot; Number.
  • 2
  • 3
  • 4

prev:Qinhuangdao old age subsidy Internet acc... next:Javascript/php implements comet (Ajax lo...
post comment
Notice



approved   The Qilu Public Welfare Alliance has...   Beautiful and impressive: the nights...   Ji'nan Ying Bi Street School: specia...   Reminder: at present, there are only...   Online test site PING value, network...
rand   10 MySQL errors that PHP developers ...   Eliminate 3 Chinese characters from ...   Importing large databases to virtual...   Using regular expressions to verify ...   Regular string replacement and parti...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com