



下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
【移動應用開發(fā)技術】微信開發(fā)之如何實現(xiàn)公交換乘功能
/*
aibang's
api
return
josn
data
d_eng
(sh209419@163.com)
2013-12-4
*/
define("APP_KEY",
"xx00ac396d6d75e8681fc8380060c5b2");
include_once
"ABClient.php";
//header("Content-Type:text/html;
charset=utf-8");
function
bustransfer($city,$start,$end)
{
$client
=
new
ABClient(APP_KEY);
list($code,
$arr)
=
$client->getBusTransfer($city,
array("start_addr"
=>$start,
"end_addr"=>$end));
if
($code<>200){
return
false;
}
$ret
="";
$buses
=
$arr[buses][bus];
//
show
the
top
3
records
$ret
=
$start
."-->".$end."\n";
$count
=
1;
foreach
($buses
as
$bus)
{
if
($count
>
3)
break;
$segments
=$bus[segments][segment];
$ret
.=
"<方案".$count++.">\n";
//
get
line
name
and
remove
remark
$linename
=
"";
foreach($segments
as
$segment)
{
if
(!empty($linename))
$linename
.=
'--'
;
$linename
.=
shortlinename($segment[line_name]);
}
$ret
.=
$linename
.
"\n"
;
$total
=
sprintf("%d分鐘
%d米
步行%d米",$bus[time],$bus[dist],$bus[foot_dist]);
$ret
.=
$total
.
"\n"
;
//
detail
$from
=
sprintf("從
%s
",$start);
$ret
.=
$from;
foreach($segments
as
$segment)
{
if
($segment[foot_dist]
>
0)
{
$segfoot
=
sprintf("步行%d米
到達
%s",$segment[foot_dist],$segment[start_stat]);
$ret
.=
$segfoot
.
"\n"
;
}
$stats
=
substr_count($segment[stats],';');
$line
=
sprintf("乘坐
%s(%d站)
到達
%s",shortlinename($segment[line_name]),$stats,$segment[end_stat]);
$ret
.=
$line
.
"\n"
;
}
if
($bus[last_foot_dist]
>
0)
{
$lastfoot
=
sprintf("步行%d米
到達
%s",$bus[last_foot_dist],$end);
$ret
.=
$lastfoot;
}
}
return
$ret;
}
function
shortlinename($linename){
return
substr($linename,0,strpos($linename,'('));
}
$a=bustransfer("南昌","老福山",
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- T-ZZB 3683-2024 水松紙卷筒料圓壓圓燙金機
- 二零二五年度房屋租賃合同(含瑜伽館)
- 2025年度肥料產品包裝設計及印刷合同
- 2025年度綠色生態(tài)果園轉讓協(xié)議書
- 二零二五年度智慧城市建設項目業(yè)績提成合同
- 天津市2025年度勞動合同解除經濟補償金支付與發(fā)放合同
- 二零二五年度科研機構與高校人才合作就業(yè)協(xié)議書范本
- 二零二五年度臨時協(xié)議書:智慧社區(qū)建設與物業(yè)管理合作
- 2025年度智能車庫租賃與智慧城市建設項目合同
- 2025年度裝配行業(yè)人才培養(yǎng)終止合同協(xié)議
- 《左傳·鄭伯克段于鄢》PPT課件(完整版)
- IPC6012C培訓
- 氮氣窒息事故案例經驗分享
- 2工藝用水驗證報告
- 原子雜化軌道理論
- 充填開采之 矸石充填術
- 醫(yī)院醫(yī)療設備采購流程圖
- 021[學士]某六層框架宿舍樓畢業(yè)設計(含計算書、圖紙)
- 人力外包項目實施方案
- BQB480-2014無取向電工鋼
- 解析幾何期末考試試卷
評論
0/150
提交評論