2017-05-28 70 views
-3

信息的URL請求信息是這樣的:我想從在PHP的

[{"name":{"first":"Lola","last":"Ewing"},"salary":"47586.03","jobTitle":"Database Analyst"},{"name":{"first":"Durham","last":"Sharpe"},"salary":"67658.3","jobTitle":"Database Analyst"},{"name":{"first":"Hines","last":"Moore"},"salary":"39317.83","jobTitle":"Web Developer"}] 

回答

0

如果從服務器處理它試試這個:

$json=[{"name":{"first":"Lola","last":"Ewing"},"salary":"47586.03","jobTitle":"Database Analyst"},{"name":{"first":"Durham","last":"Sharpe"},"salary":"67658.3","jobTitle":"Database Analyst"},{"name":{"first":"Hines","last":"Moore"},"salary":"39317.83","jobTitle":"Web Developer"}] 
$arr=json_decode($json); 
echo arr['name']['first']; 
// echo implode (" " , arr['name']); output: Hines Moore 

如果我正確這個明白你的問題將是你正在尋找的

+0

所以你可以像這樣拉這一切 – lostscott

+0

$(document).ready(function(){ $(「#button」)。click(function(){\t \t \t \t var resultfirst = $('#div'); $阿賈克斯(網址:{url: 「HTTP:blabla.php」, \t \t方法: 'GET', \t \t數據類型: 'JSON', \t \t成功:功能(數據) \t \t { \t \t var myarray = JSON.parse(date); }}); }); }); – lostscott

+0

會工作到都靈信息到一個JSON數組,我可以拉我想要的東西 – lostscott