可以在PHP端把多个参数封装成一个对象。比如 $people['age'] = "21"; $people['gender'] = "male"; $people['phoneNum'] = "12345678"; 然后 echo json_encode($people); json_encode()函数的作用是把$people打包成一个JSON结构的对象。 然后在js端用eval(
可以在PHP端把多个参数封装成一个对象。比如
$people['age'] = "21";
$people['gender'] = "male";
$people['phoneNum'] = "12345678";
然后 echo json_encode($people);
json_encode()函数的作用是把$people打包成一个JSON结构的对象。
然后在js端用eval()函数将JSON结构解析成一个对象,就可以用obj.age或者obj.phoneNum的形式调用PHP传过来的参数了。
详细的例子可以看这个:
http://www.cnblogs.com/elaron/archive/2010/11/16/1878369.html

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft