最短路径导航系统

最短路径导航系统

设置一:临省之间才可以通车


可访问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("--
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值