随机风景图片API接口


接口地址

https://api.vvhan.com/api/view

返回格式

JSON

请求方式:

GET

请求示例(图片输出):

https://api.vvhan.com/api/view

请求示例(JSON输出):

https://api.vvhan.com/api/view?type=json

参数说明

名称 必填 类型 说明
type string 要输出的格式

返回数据

{"code": "200","viewurl": "http:\/\/url.vvhan.com\/viewimg\/api.vvhan.com[16].jpg","width": "2048","height": "1152","size": "jpg"}

调用实例

<img src="https://api.vvhan.com/api/view" alt="韩小韩API">

示例代码

<?php
header('Content-type:text/json;charset=utf-8;'); date_default_timezone_set("PRC"); $url="https://api.vvhan.com/api/view"; $type = $_GET['type']; if($type=="json"){ $result = file_get_contents($url."?type=json"); echo $result; } else{ header("Location:".$url); }
?>