工具 · 驾考题库
驾照考试题库,科目一和科目四2种

接口地址: https://58.linkpc.net/api/jiakao

返回格式: JSON

请求方式: GET

请求示例: https://58.linkpc.net/api/jiakao?t=1

请求参数说明:

名称 必填 类型 说明
t string 1是科目一2是科目四默认返回科目一

返回参数说明:

名称 类型 说明

返回示例:

{
"code": 200,
"msg": "成功",
"data": [
{
"question": "车辆前轮胎爆裂,危险较大,方向会立刻向爆胎车轮一侧跑偏,直接影响驾驶人对转向盘的控制。",
"answer": "对",
"explain": "爆胎后,车辆整体平衡会受到影响,会向爆胎的一边跑偏,直接影响到驾驶人对转向盘的控制。",
"type": "C1,C2,C3",
"chapter": "道路通行条件及通行规定"
}
]
}

错误码格式说明:

名称 类型 说明

代码示例:

                            <?php
header('Content-type: application/json; charset=utf-8');
date_default_timezone_set('PRC');
$url = 'https://58.linkpc.net/api/jiakao?t=1;
$type = isset($_GET['type']) ? $_GET['type'] : '';
if ($type == 'json' || $type == 'JSON') {
$result = file_get_contents($url . '?type=json');
echo htmlspecialchars($result);
} else {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
curl_close($ch);

if (strpos($contentType, 'image') !== false) {
header('Content-Type: ' . $contentType);
echo $response;
} elseif (strpos($contentType, 'text') !== false) {
header('Content-Type: ' . $contentType);
echo $response;
} elseif (strpos($contentType, 'application/json') !== false) {
header('Content-Type: application/json');
echo $response;
} else {
header('Content-Type: text/html');
echo $response;
}
}
?>