2011-09-20 161 views

回答

1

尝试

<?php 

//make http request 
$response = file_get_contents('https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY&q=hello%20world&source=en&target=de'); 

//decode json to array 
$json = json_decode($response); 

//show the json array in a readable format 
echo '<pre>'; 

//show array 
print_r($json); 

?> 

然后,您可以访问特定的节点与echo $json['key_name']

有用网址:

http://php.net/manual/en/function.file-get-contents.php

http://php.net/manual/en/function.json-decode.php