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   Sichuan Leshan 84 year old Lao Tai a...   Loss of breast and cancer coexistenc...   The "ship man" in the city: the aver...   After graduation, I learned about th...   "Tang Ye Da Ma" on Chuang Cheng Road
rand   PHP implementation of Web screenshot   Snap2HTML - hard disk file generatio...   PHP random number generation and use...   Talk about 10 MySQL mistakes that PH...   10 MySQL errors that PHP developers ...
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