嘿,我正在尝试使用PHP的谷歌图像api,我真的不知道该怎么做.
这基本上就是我现在所拥有的:
$jsonurl = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=test";
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json);
Run Code Online (Sandbox Code Playgroud)
我从那里去哪里取回第一张图片网址?
Mar*_*cel 10
通过对代码示例的最后一行进行微小更改,以下内容将输出结果集中第一个图像的URL.
<?php
$jsrc = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=test";
$json = file_get_contents($jsrc);
$jset = json_decode($json, true);
echo $jset["responseData"]["results"][0]["url"];
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9982 次 |
| 最近记录: |