


1) API application
2) API call
3) [b] Effect display [/b]
4) Accurate query
------------ -------------------------------------------------- ------------
1) API application
Aibang provides query interface API, you need to apply for Key www.aibang.com
The number of queries is limited , 2013-12-4 Up to 1000 times/10 times/minute per day
Returnjsondata
Provide data description
Provide demo file
2) API call
After calling the API to obtain the data, you can output it in your own format
/* aibang's api return josn data d_eng (sh109419@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("南昌","老福山","青山路口"); var_dump($a);
3) Effect display
4) Accurate query
In bus query, you are required to enter the bus/subway station name
If you don’t know the accurate station name, you often cannot get the result,
On the web page, the system can prompt you to select the correct bus stop,
However, it is inconvenient to do this on WeChat
The improvement plan is as follows:
Aibang has a bus station query API
Use this API to find the stations near the user's input information and take out the first one as a bus transfer station
In this way, the probability of successful bus transfer search increases.
【Related Recommendations】
1. Special Recommendation: "php Programmer Toolbox" V0.1 version download
2. WeChat public account platform source code download
3. WeChat voting source code free download
The above is the detailed content of Detailed explanation of bus transfer function code developed by WeChat. For more information, please follow other related articles on the PHP Chinese website!

PHP是一种开源的脚本语言,广泛应用于Web开发和服务器端编程,尤其在微信开发中得到了广泛的应用。如今,越来越多的企业和开发者开始使用PHP进行微信开发,因为它成为了一款真正的易学易用的开发语言。在微信开发中,消息的加密和解密是一个非常重要的问题,因为它们涉及到数据的安全性。对于没有加密和解密方式的消息,黑客可以轻松获取到其中的数据,对用户造成威胁

微信是目前全球用户规模最大的社交平台之一,随着移动互联网的普及,越来越多的企业开始意识到微信营销的重要性。在进行微信营销时,客服服务是至关重要的一环。为了更好地管理客服聊天窗口,我们可以借助PHP语言进行微信开发。一、PHP微信开发简介PHP是一种开源的服务器端脚本语言,广泛运用于Web开发领域。结合微信公众平台提供的开发接口,我们可以使用PHP语言进行微信

在微信公众号开发中,用户标签管理是一个非常重要的功能,可以让开发者更好地了解和管理自己的用户。本篇文章将介绍如何使用PHP实现微信用户标签管理功能。一、获取微信用户openid在使用微信用户标签管理功能之前,我们首先需要获取用户的openid。在微信公众号开发中,通过用户授权的方式获取openid是比较常见的做法。在用户授权完成后,我们可以通过以下代码获取用

利用JavaScript和腾讯地图实现地图公交换乘功能地图公交换乘功能在如今的生活中变得越来越重要。无论是在新城市旅行或日常通勤中,都需要一款方便、实用的公交换乘功能来帮助我们规划出行路线。在本文中,我们将介绍如何利用JavaScript和腾讯地图来实现地图公交换乘功能,并提供具体的代码示例。要实现地图公交换乘功能,我们首先需要引入腾讯地图的API。可以通过

随着微信的普及,越来越多的企业开始将其作为营销工具。而微信群发功能,则是企业进行微信营销的重要手段之一。但是,如果只依靠手动发送,对于营销人员来说是一件极为费时费力的工作。所以,开发一款微信群发工具就显得尤为重要。本文将介绍如何使用PHP开发微信群发工具。一、准备工作开发微信群发工具,我们需要掌握以下几个技术点:PHP基础知识微信公众平台开发开发工具:Sub

随着互联网和移动智能设备的发展,微信成为了社交和营销领域不可或缺的一部分。在这个越来越数字化的时代,如何使用PHP进行微信开发已经成为了很多开发者的关注点。本文主要介绍如何使用PHP进行微信开发的相关知识点,以及其中的一些技巧和注意事项。一、开发环境准备在进行微信开发之前,首先需要准备好相应的开发环境。具体来说,需要安装PHP的运行环境,以及微信公众平台提

随着微信成为了人们生活中越来越重要的一个通讯工具,其敏捷的消息传递功能迅速受到广大企业和个人的青睐。对于企业而言,将微信发展为一个营销平台已经成为趋势,而微信开发的重要性也逐渐凸显。在其中,群发功能更是被广泛使用,那么,作为PHP程序员,如何实现群发消息发送记录呢?下面将为大家简单介绍一下。1.了解微信公众号相关开发知识在了解如何实现群发消息发送记录之前,我

ThinkPHP6微信开发指南:快速搭建微信公众号应用引言:微信公众号作为一种重要的社交媒体平台,为个人和企业在市场推广、信息传播等方面提供了很大的机会。在这篇文章中,我们将介绍如何使用ThinkPHP6快速搭建一个微信公众号应用,并且提供一些常用的代码示例。环境准备在开始开发之前,我们首先需要准备好以下环境:PHP7以上版本ThinkPHP6框架微信公众号


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment
