首页 车型大全 车型大全示例代码 根据品牌获取所有车型[PHP]

根据品牌获取所有车型示例代码[PHP]

作者: 阅读数:1490 上传时间:2016-03-10

根据品牌获取所有车型

<?php

require_once 'curl.func.php';

$appkey = 'your_appkey_here';//你的appkey
$parentid = 1;//品牌ID
$url = "https://api.jisuapi.com/car/carlist?parentid=$parentid&appkey=$appkey";
$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));
if($jsonarr['status'] != 0)
{
    echo $jsonarr['msg'];
    exit();
}

$result = $jsonarr['result'];
foreach($result as $val)
{
    echo $val['id'].' '.$val['name'].' '.$val['initial'].' '.$val['parentid'].' '.$val['depth'].'

';//车子公司信息,2级 foreach($val['carlist'] as $v) { echo $v['id'].' '.$v['name'].' '.$v['initial'].' '.$v['parentid'].' '.$v['depth'].' '.$v['fullname'].' '.$v['logo'].' '.$v['salestate'].'
';//车信息,3级 foreach($v['list'] as $vv) { echo $vv['id'].' '.$vv['name'].' '.$vv['initial'].' '.$vv['parentid'].' '.$vv['depth'].' '.$vv['logo'].' '.$vv['salestate'].' '.$vv['price'].' '.$vv['yeartype'].' '.$vv['productionstate'].' '.$vv['sizetype'].'
';//具体的每一款车,4级 } } }