最短路径导航系统
设置一:临省之间才可以通车
可访问http://202.194.119.110/map/car/map/index.php
关键代码
车票获取系统(调用某网站api)接口
chepiao100.php
<?php require 'config.php';//配置文件 class chepiao100 { private $_apiurl = 'http://www.chepiao100.com/api/'; //$method get or post 方式 //$param 参数 function getData($method, $param) { global $config; $param['userid'] = $config['userid']; $param['seckey'] = $config['seckey']; $post = http_build_query($param); $html = $this->fetch_html($this->_apiurl.$method, $post); $jsonArr = json_decode($html, TRUE); if ( $jsonArr['errMsg'] == 'Y') { return $jsonArr['data']; } else { return $jsonArr['errMsg']; } } //扒取数据 function fetch_html($url, $post)
<?php @header('Content-Type: text/html; charset=utf-8'); //获得最小分钟 //输入起止时间 //返回时间与时间相差的数据 function getminute($starttime,$endtime){ if(floor((@strtotime($endtime)-@strtotime($starttime))%86400/60)>0) return floor((@strtotime($endtime)-@strtotime($starttime))%86400/60); else return floor((@strtotime($endtime)-@strtotime($starttime))%86400/60)+1440; } //获得最短时间 function getMax($data){ $min = 9999; for($index = 0;$index<count($data);$index++){ if($data[$index]['0'] < $min && $data[$index]['0']>0){ $min = $data[$index]['0']; } } return $min; } //获取最省金钱 function money_min($data){ $min = 9999; for($index=0;$index<count($data);$index++){ if($data[$index]['1'] < $min && $data[$index]['1']>0){ $min = $data[$index]['1']; //echo $min; } } return $min; } function get_min_money($data,$index){ if(count($data)!=0&&$data[0]!='I') { //for ($index = 0;$index<count($data);$index++) { $two_seat_prc = $data[$index]['two-seat-prc']; $hard_seat_prc = $data[$index]['hard-seat-prc']; $two_seat_prc = str_replace("¥","",$two_seat_prc); $two_seat_prc = str_replace("--","9999",$two_seat_prc); $two_seat_prc = doubleval($two_seat_prc); $hard_seat_prc = str_replace("¥","",$hard_seat_prc); $hard_seat_prc =str_replace("--