php实现按天数、星期、月份查询的搜索框_php技巧

本文实例为大家分享了php实现按天数、星期、月份查询的搜索框,搜索时候展示数据的统计图,主要展示图形的效果,供大家参考,具体内容如下

1.ajax.php

<?php

    $year = $_GET['y'];
    if(!isset($_GET['m'])){
       $month=1;
    }else{
         $month = $_GET['m'];
    }
    $week_arr = getMonthWeekArr($year, $month);
    echo json_encode($week_arr);
    die;

  /**
 * 获得系统某月的周数组,第一周不足的需要补足
 *
 * @param int $current_year
 * @param int $current_month
 * @return string[][]
 */
function getMonthWeekArr($current_year, $current_month){

  //该月第一天
  $firstday = strtotime($current_year.'-'.$current_month.'-01');
  //该月的第一周有几天
  $firstweekday = (7 - date('N',$firstday) +1);
  //计算该月第一个周一的时间
  $starttime = $firstday-3600*24*(7-$firstweekday);
  //该月的最后一天
  $lastday = strtotime($current_year.'-'.$current_month.'-01'." +1 month -1 day");
  //该月的最后一周有几天
  $lastweekday = date('N',$lastday);
  //该月的最后一个周末的时间
  $endtime = $lastday-3600*24*($lastweekday%7);
  $step = 3600*24*7;//步长值
  $week_arr = array();
  for ($i=$starttime; $i<$endtime; $i= $i+3600*24*7){
    $week_arr[] = array('key'=>date('Y-m-d',$i).'|'.date('Y-m-d',$i+3600*24*6), 'val'=>date('Y-m-d',$i).'~'.date('Y-m-d',$i+3600*24*6));
  }
  return $week_arr;
}

2.datehelper.php

<?php

 //获得系统年份数组
/**
 *
 * @return string[]
 */
function getSystemYearArr(){
  $year_arr = array('2010'=>'2010','2011'=>'2011','2012'=>'2012','2013'=>'2013','2014'=>'2014','2015'=>'2015','2016'=>'2016','2017'=>'2017','2018'=>'2018','2019'=>'2019','2020'=>'2020');
  return $year_arr;
}

/**
 * 获得系统月份数组
 *
 * @return array
 */
function getSystemMonthArr(){

  $month_arr = array('1'=>'01','2'=>'02','3'=>'03','4'=>'04','5'=>'05','6'=>'06','7'=>'07','8'=>'08','9'=>'09','10'=>'10','11'=>'11','12'=>'12');
  return $month_arr;
}

/**
 * 获得系统周数组
 *
 * @return string[]
 */
function getSystemWeekArr(){
  $week_arr = array('1'=>'周一','2'=>'周二','3'=>'周三','4'=>'周四','5'=>'周五','6'=>'周六','7'=>'周日');
  return $week_arr;
}

/**
 * 获取某月的最后一天
 *
 * @param int $year
 * @param int $month
 * @return number
 */
function getMonthLastDay($year, $month){

  $t = mktime(0, 0, 0, $month + 1, 1, $year);
  $t = $t - 60 * 60 * 24;
  return $t;
}

/**
 * 获得系统某月的周数组,第一周不足的需要补足
 *
 * @param int $current_year
 * @param int $current_month
 * @return string[][]
 */
function getMonthWeekArr($current_year, $current_month){

  //该月第一天
  $firstday = strtotime($current_year.'-'.$current_month.'-01');
  //该月的第一周有几天
  $firstweekday = (7 - date('N',$firstday) +1);
  //计算该月第一个周一的时间
  $starttime = $firstday-3600*24*(7-$firstweekday);
  //该月的最后一天
  $lastday = strtotime($current_year.'-'.$current_month.'-01'." +1 month -1 day");
  //该月的最后一周有几天
  $lastweekday = date('N',$lastday);
  //该月的最后一个周末的时间
  $endtime = $lastday-3600*24*($lastweekday%7);
  $step = 3600*24*7;//步长值
  $week_arr = array();
  for ($i=$starttime; $i<$endtime; $i= $i+3600*24*7){
    $week_arr[] = array('key'=>date('Y-m-d',$i).'|'.date('Y-m-d',$i+3600*24*6), 'val'=>date('Y-m-d',$i).'~'.date('Y-m-d',$i+3600*24*6));
  }
  return $week_arr;
}

 /**
   * 处理搜索时间
   */
 function dealwithSearchTime($search_arr=''){
    //初始化时间
    //天
    if(!isset($search_arr['search_time'])){
      $search_arr['search_time'] = date('Y-m-d', time()- 86400);
    }

    $search_arr['day']['search_time'] = strtotime($search_arr['search_time']);//搜索的时间
    //周
    if(!isset($search_arr['searchweek_year'])){
      $search_arr['searchweek_year'] = date('Y', time());
    }
    if(!isset($search_arr['searchweek_month'])){
      $search_arr['searchweek_month'] = date('m', time());
    }
    if(!isset($search_arr['searchweek_week'])){
      $search_arr['searchweek_week'] = implode('|', getWeek_SdateAndEdate(time()));
    }

    $weekcurrent_year = $search_arr['searchweek_year'];
    $weekcurrent_month = $search_arr['searchweek_month'];
    $weekcurrent_week = $search_arr['searchweek_week'];
    $search_arr['week']['current_year'] = $weekcurrent_year;
    $search_arr['week']['current_month'] = $weekcurrent_month;
    $search_arr['week']['current_week'] = $weekcurrent_week;

    //月
    if(!isset($search_arr['searchmonth_year'])){
      $search_arr['searchmonth_year'] = date('Y', time());
    }
    if(!isset($search_arr['searchmonth_month'])){
      $search_arr['searchmonth_month'] = date('m', time());
    }
    $monthcurrent_year = $search_arr['searchmonth_year'];
    $monthcurrent_month = $search_arr['searchmonth_month'];
    $search_arr['month']['current_year'] = $monthcurrent_year;
    $search_arr['month']['current_month'] = $monthcurrent_month;
    return $search_arr;
  }

  /**
   * 获取本周的开始时间和结束时间
   *
   * @param int $current_time
   * @return string
   */
  function getWeek_SdateAndEdate($current_time){

    $current_time = strtotime(date('Y-m-d',$current_time));
    $return_arr['sdate'] = date('Y-m-d', $current_time-86400*(date('N',$current_time) - 1));
    $return_arr['edate'] = date('Y-m-d', $current_time+86400*(7- date('N',$current_time)));

    return $return_arr;
  }
  /**
   * 查询每月的周数组
   */
 function getweekofmonth(){
    $year = $_GET['y'];
    $month = $_GET['m'];
    $week_arr = getMonthWeekArr($year, $month);
    echo json_encode($week_arr);
    die;
  }

3.statistics.php

<?php
/**
 * 统计
 *
 * @abstract
 *
 * @copyright 格里西,2016
 *
 * @author liujun
 *
 * @version Id:statics v1.0 2016/2/5
 */

/**
 * 获得折线图统计图数据
 *
 * param $statarr 图表需要的设置项
 * @return string
 */
function getStatData_LineLabels($stat_arr){

  //图表区、图形区和通用图表配置选项
  $stat_arr['chart']['type'] = 'line';
  //图表序列颜色数组
  $stat_arr['colors']?'':$stat_arr['colors'] = array('#058DC7', '#ED561B', '#8bbc21', '#0d233a');
  //去除版权信息
  $stat_arr['credits']['enabled'] = false;
  //导出功能选项
  $stat_arr['exporting']['enabled'] = false;
  //标题如果为字符串则使用默认样式
  is_string($stat_arr['title'])?$stat_arr['title'] = array('text'=>"<b>{$stat_arr['title']}</b>",'x'=>-20):'';
  //子标题如果为字符串则使用默认样式
  is_string($stat_arr['subtitle'])?$stat_arr['subtitle'] = array('text'=>"<b>{$stat_arr['subtitle']}</b>",'x'=>-20):'';
  //Y轴如果为字符串则使用默认样式
  if(is_string($stat_arr['yAxis'])){
    $text = $stat_arr['yAxis'];
    unset($stat_arr['yAxis']);
    $stat_arr['yAxis']['title']['text'] = $text;
  }
  return json_encode($stat_arr);
}

/**
 * 获得Column2D统计图数据
 *
 * @param array $stat_arr
 * @return string
 */
function getStatData_Column2D($stat_arr){

  //图表区、图形区和通用图表配置选项
  $stat_arr['chart']['type'] = 'column';
  //去除版权信息
  $stat_arr['credits']['enabled'] = false;
  //导出功能选项
  $stat_arr['exporting']['enabled'] = false;
  //标题如果为字符串则使用默认样式
  is_string($stat_arr['title'])?$stat_arr['title'] = array('text'=>"<b>{$stat_arr['title']}</b>",'x'=>-20):'';
  //子标题如果为字符串则使用默认样式
  is_string($stat_arr['subtitle'])?$stat_arr['subtitle'] = array('text'=>"<b>{$stat_arr['subtitle']}</b>",'x'=>-20):'';
  //Y轴如果为字符串则使用默认样式
  if(is_string($stat_arr['yAxis'])){
    $text = $stat_arr['yAxis'];
    unset($stat_arr['yAxis']);
    $stat_arr['yAxis']['title']['text'] = $text;
  }
  //柱形的颜色数组
  $color = array('#7a96a4','#cba952','#667b16','#a26642','#349898','#c04f51','#5c315e','#445a2b','#adae50','#14638a','#b56367','#a399bb','#070dfa','#47ff07','#f809b7');

  foreach ($stat_arr['series'] as $series_k=>$series_v){
    foreach ($series_v['data'] as $data_k=>$data_v){
      $data_v['color'] = $color[$data_k];
      $series_v['data'][$data_k] = $data_v;
    }
    $stat_arr['series'][$series_k]['data'] = $series_v['data'];
  }
  //print_r($stat_arr); die;
  return json_encode($stat_arr);
}

/**
 * 获得Basicbar统计图数据
 *
 * @param array $stat_arr
 * @return string
 */
function getStatData_Basicbar($stat_arr){

  //图表区、图形区和通用图表配置选项
  $stat_arr['chart']['type'] = 'bar';
  //去除版权信息
  $stat_arr['credits']['enabled'] = false;
  //导出功能选项
  $stat_arr['exporting']['enabled'] = false;
  //显示datalabel
  $stat_arr['plotOptions']['bar']['dataLabels']['enabled'] = true;
  //标题如果为字符串则使用默认样式
  is_string($stat_arr['title'])?$stat_arr['title'] = array('text'=>"<b>{$stat_arr['title']}</b>",'x'=>-20):'';
  //子标题如果为字符串则使用默认样式
  is_string($stat_arr['subtitle'])?$stat_arr['subtitle'] = array('text'=>"<b>{$stat_arr['subtitle']}</b>",'x'=>-20):'';
  //Y轴如果为字符串则使用默认样式
  if(is_string($stat_arr['yAxis'])){
    $text = $stat_arr['yAxis'];
    unset($stat_arr['yAxis']);
    $stat_arr['yAxis']['title']['text'] = $text;
  }
  //柱形的颜色数组
  $color = array('#7a96a4','#cba952','#667b16','#a26642','#349898','#c04f51','#5c315e','#445a2b','#adae50','#14638a','#b56367','#a399bb','#070dfa','#47ff07','#f809b7');

  foreach ($stat_arr['series'] as $series_k=>$series_v){
    foreach ($series_v['data'] as $data_k=>$data_v){
      if (!$data_v['color']){
        $data_v['color'] = $color[$data_k%15];
      }
      $series_v['data'][$data_k] = $data_v;
    }
    $stat_arr['series'][$series_k]['data'] = $series_v['data'];
  }
  //print_r($stat_arr); die;
  return json_encode($stat_arr);
}

/**
 * 计算环比
 *
 * @param array $updata
 * @param array $currentdata
 * @return string
 */
function getHb($updata, $currentdata){

  if($updata != 0){
    $mtomrate = round(($currentdata - $updata)/$updata*100, 2).'%';
  } else {
    $mtomrate = '-';
  }
  return $mtomrate;
}

/**
 * 计算同比
 *
 * @param array $updata
 * @param array $currentdata
 * @return string
 */
function getTb($updata, $currentdata){

  if($updata != 0){
    $ytoyrate = round(($currentdata - $updata)/$updata*100, 2).'%';
  } else {
    $ytoyrate = '-';
  }
  return $ytoyrate;
}

/**
 * 地图统计图
 *
 * @param array $stat_arr
 * @return string
 */
function getStatData_Map($stat_arr){

  //$color_arr = array('#f63a3a','#ff5858','#ff9191','#ffc3c3','#ffd5d5');
  $color_arr = array('#fd0b07','#ff9191','#f7ba17','#fef406','#25aae2');
  $stat_arrnew = array();
  foreach ($stat_arr as $k=>$v){
    $stat_arrnew[] = array('cha'=>$v['cha'],'name'=>$v['name'],'des'=>$v['des'],'color'=>$color_arr[$v['level']]);
  }
  return json_encode($stat_arrnew);
}

/**
 * 获得饼形图数据
 *
 * @param array $data
 * @return string
 */
function getStatData_Pie($data){

  $stat_arr['chart']['type'] = 'pie';
  $stat_arr['credits']['enabled'] = false;
  $stat_arr['title']['text'] = $data['title'];
  $stat_arr['tooltip']['pointFormat'] = '{series.name}: <b>{point.y}</b>';
  $stat_arr['plotOptions']['pie'] = array(
    'allowPointSelect'=>true,
    'cursor'=>'pointer',
    'dataLabels'=>array(
      'enabled'=>$data['label_show'],
      'color'=>'#000000',
      'connectorColor'=>'#000000',
      'format'=>'<b>{point.name}</b>: {point.percentage:.1f} %'
    )
  );
  $stat_arr['series'][0]['name'] = $data['name'];
  $stat_arr['series'][0]['data'] = array();
  foreach ($data['series'] as $k=>$v){
    $stat_arr['series'][0]['data'][] = array($v['p_name'],$v['allnum']);
  }
  //exit(json_encode($stat_arr));
  return json_encode($stat_arr);
}

4.theline.php  

<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--引入ECharts文件-->
<title>Echarts</title>
<script src="js/echarts.common.min.js"></script>
</head>
<script src="js/jquery.js"></script>
<?php include('php/datehelper.php');include('php/statistics.php');?>
<?php 

      //获得系统年份
      $year_arr = getSystemYearArr();
      //获得系统月份
      $month_arr = getSystemMonthArr();
      //存储参数
      $search_arr = $_REQUEST;
      $search_arr =dealwithSearchTime($search_arr);
      //获得本月的周时间段
      $week_arr = getMonthWeekArr($search_arr['week']['current_year'],$search_arr['week']['current_month']);
      //天数
      if(!isset($_REQUEST['search_time'])){
        $_REQUEST['search_time'] = date('Y-m-d', time()-86400);
      }
      $search_time = $_REQUEST['search_time'];//搜索的时间
        //周
      if(!isset($_REQUEST['search_time_year'])){
        $_REQUEST['search_time_year'] = date('Y', time());
      }
      if(!isset($_REQUEST['search_time_month'])){
        $_REQUEST['search_time_month'] = date('m', time());
      }
      if(!isset($_REQUEST['search_time_week'])){
        $_REQUEST['search_time_week'] = implode('|', getWeek_SdateAndEdate(time()));
      }

      $current_year = $_REQUEST['search_time_year'];
      $current_month = $_REQUEST['search_time_month'];
      $current_week = $_REQUEST['search_time_week'];

?>
<style>
#search_type{float:left}
#searchtype_day{float:left}
#searchtype_week{float:left}
#searchtype_month{float:left}

</style>
<body>
  <select name="search_type" id="search_type" >
         <option value="day" >按照天统计</option>
         <option value="week" >按照周统计</option>
         <option value="month">按照月统计</option>
    </select>
    <div class="w140" id="searchtype_day">
      <div class='input-group date' id='datetimepicker1'>
        <input id="stime" class="form-control" type="text" value="<?php echo $search_time;?>" name="search_time">
        <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
      </div>
    </div>
     <div id="searchtype_week" style="display:none;">
        <select name="search_time_year" id="searchweek_year">
          <?php foreach ($year_arr as $k=>$v){?>
          <option value="<?php echo $k;?>" <?php echo $current_year == $k?'selected':'';?>><?php echo $v; ?></option>
          <?php } ?>
        </select>
        <select name="search_time_month" id="searchweek_mouth">
          <?php foreach ($month_arr as $k=>$v){?>
          <option value="<?php echo $k;?>" <?php echo $current_month == $k?'selected':'';?>><?php echo $v; ?></option>
          <?php } ?>
        </select>
        <select name="search_time_week" id="searchweek_week">
          <?php foreach ($week_arr as $k=>$v){?>
          <option value="<?php echo $v['key'];?>" <?php echo $current_week == $v['key']?'selected':'';?> ><?php echo $v['val']; ?></option>
          <?php } ?>
        </select>
       </div> 

      <div id="searchtype_month" style="display:none;">
          <select name="search_time_year" class="querySelect">
          <?php foreach ($year_arr as $k=>$v){?>
          <option value="<?php echo $k;?>" <?php echo $current_year == $k?'selected':'';?> ><?php echo $v; ?></option>
          <?php } ?>
        </select>
        <select name="search_time_month" class="querySelect">
          <?php foreach ($month_arr as $k=>$v){?>
          <option value="<?php echo $k;?>" <?php echo $current_month == $k?'selected':'';?>><?php echo $v; ?></option>
          <?php } ?>
        </select>
      </div>
   <div id="line_chart" style="width:600px;height:400px;"></div>
   <?php $thearray=array(11,11,15,13,12,13,10);?>
   <script type="text/javascript">
    // 基于准备好的dom,初始化echarts实例

    var mylineChart=echarts.init(document.getElementById('line_chart'));

    option1 = {
  title: {
    text: '未来一周气温变化',
    subtext: '纯属虚构'
  },
  tooltip: {
    trigger: 'axis'
  },
  legend: {
    data:['最高气温','最低气温']
  },
  toolbox: {
    show: true,
    feature: {
      dataZoom: {},
      // dataView: {readOnly: false},
      magicType: {type: ['line', 'bar']},
      restore: {},
      saveAsImage: {}
    }
  },
  xAxis: {
    type: 'category',
    boundaryGap: false,
    data: ['周一','周二','周三','周四','周五','周六','周日']
  },
  yAxis: {
    type: 'value',
    axisLabel: {
      formatter: '{value} °C'
    }
  },
  series: [
    {
      name:'最高气温',
      type:'line',
      data:<?php echo(json_encode($thearray)); ?>,
      markPoint: {
        data: [
          {type: 'max', name: '最大值'},
          {type: 'min', name: '最小值'}
        ]
      },
      markLine: {
        data: [
          {type: 'average', name: '平均值'}
        ]
      }
    },
    {
      name:'最低气温',
      type:'line',
      data:[1, 4, 2, 5, 3, 2, 0],
      markPoint: {
        data: [
          {name: '周最低', value: -2, xAxis: 1, yAxis: -1.5}
        ]
      },
      markLine: {
        data: [
          {type: 'average', name: '平均值'}
        ]
      }
    }
  ]
};
    // 使用刚指定的配置项和数据显示图表。
    mylineChart.setOption(option1);
  </script>
  <script>
  //展示搜索时间框
function show_searchtime(){
  s_type = $("#search_type").val();
  $("[id^='searchtype_']").hide();
  $("#searchtype_"+s_type).show();
}
  $(function(){

    show_searchtime();
  $("#search_type").change(function(){
    show_searchtime();
  });

  //更新周数组
  $("[name='search_time_month']").change(function(){

    var year = $("[name='search_time_year']").val();
    var month = $("[name='search_time_month']").val();

    $("[name='search_time_week']").empty();
    $.getJSON('php/ajax.php',{y:year,m:month},function(data){
      if(data != null){
        for(var i = 0; i < data.length; i++) {
          $("[name='search_time_week']").append('<option value="'+data[i].key+'">'+data[i].val+'</option>');
        }
      }
    });
  });
  //更新年数组
    $("[name='search_time_year']").change(function(){
    var year = $("[name='search_time_year']").val();

    $("[name='search_time_week']").empty();
    $("#searchweek_mouth option:first").prop("selected", 'selected');
    $.getJSON('php/ajax.php',{y:year},function(data){
      if(data != null){
        for(var i = 0; i < data.length; i++) {
          $("[name='search_time_week']").append('<option value="'+data[i].key+'">'+data[i].val+'</option>');
        }

      }
    });
  });

  });

  </script>
</body>
</html>

5.time_deal.php

<?php 

//获取系统年份
/**
 *
 * @return string[]
 */
function getSystemYearArr(){

  $year_arr = array('2010'=>'2010','2011'=>'2011','2012'=>'2012','2013'=>'2013','2014'=>'2014','2015'=>'2015','2016'=>'2016','2017'=>'2017','2018'=>'2018','2019'=>'2019','2020'=>'2020');
  return $year_arr;
}

/**
 * 获得系统月份数组
 *
 * @return array
 */
function getSystemMonthArr(){

  $month_arr = array('1'=>'01','2'=>'02','3'=>'03','4'=>'04','5'=>'05','6'=>'06','7'=>'07','8'=>'08','9'=>'09','10'=>'10','11'=>'11','12'=>'12');
  return $month_arr;
}

  /**
   * 处理搜索时间
   */
  public function dealwithSearchTime($search_arr){
    //初始化时间
    //天
    if(!$search_arr['search_time']){
      $search_arr['search_time'] = date('Y-m-d', time()- 86400);
    }
    $search_arr['day']['search_time'] = strtotime($search_arr['search_time']);//搜索的时间

    //周
    if(!$search_arr['searchweek_year']){
      $search_arr['searchweek_year'] = date('Y', time());
    }
    if(!$search_arr['searchweek_month']){
      $search_arr['searchweek_month'] = date('m', time());
    }
    if(!$search_arr['searchweek_week']){
      $search_arr['searchweek_week'] = implode('|', getWeek_SdateAndEdate(time()));
    }
    $weekcurrent_year = $search_arr['searchweek_year'];
    $weekcurrent_month = $search_arr['searchweek_month'];
    $weekcurrent_week = $search_arr['searchweek_week'];
    $search_arr['week']['current_year'] = $weekcurrent_year;
    $search_arr['week']['current_month'] = $weekcurrent_month;
    $search_arr['week']['current_week'] = $weekcurrent_week;

    //月
    if(!$search_arr['searchmonth_year']){
      $search_arr['searchmonth_year'] = date('Y', time());
    }
    if(!$search_arr['searchmonth_month']){
      $search_arr['searchmonth_month'] = date('m', time());
    }
    $monthcurrent_year = $search_arr['searchmonth_year'];
    $monthcurrent_month = $search_arr['searchmonth_month'];
    $search_arr['month']['current_year'] = $monthcurrent_year;
    $search_arr['month']['current_month'] = $monthcurrent_month;
    return $search_arr;
  }

以上就是本文的全部内容,希望对大家的学习有所帮助。

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索php
, 搜索框
, 月份
, 天数
星期
星期几下跌天数最多、月份天数、2017年1月份出勤天数、2017年1月份上班天数、js获取当前月份的天数,以便于您获取更多的相关知识。

时间: 2024-09-15 05:52:55

php实现按天数、星期、月份查询的搜索框_php技巧的相关文章

php二分法在IP地址查询中的应用_php技巧

数据库大概存储几十万条IP记录,记录集如下: +----------+----------+------------+---------+---------+--------+--------+  | ip_begin | ip_end   | country_id | prov_id | city_id | isp_id | netbar |  +----------+----------+------------+---------+---------+--------+--------+ 

详解WordPress中给链接添加查询字符串的方法_php技巧

查询字符串指的是链接中后边的问号后的查询语句,格式为 key=value,多个查询语句用 & 符号分开.add_query_arg() 函数就是 WordPress 提供的一个方便的函数,可以帮你给一个链接添加一个或者多个查询语句. 有人会问,添加查询字符串直接在链接后边手动追加不就可以了吗?这样有时候可行,但链接如果本身就有查询字符串就会造成格式错误的问题,而且也不利于 PHP 编写管理,而 add_query_arg() 函数帮你把一切都想好了,你只需要给出要添加查询字符串的链接和一个或多个

php whois查询API制作方法_php技巧

这里我们从万网或新网的数据接口取得数据,透过php的简单文本处理再输出. 复制代码 代码如下: <php? $domain = $_GET['q']; preg_match("| <div class="\"lyTableInfoWrap\"">(.+?)</div> |is", @file_get_contents('http://www.xinnet.cn/Modules/agent/serv/pages/dom

微信公众平台之快递查询功能用法实例_php技巧

本文实例讲述了微信公众平台之快递查询功能用法.分享给大家供大家参考.具体如下: 使用方法: #查快递(或三个首字母ckd)#快递编号#快递单号 如(查询EMS单号为1034616494006的快递): #ckd#15#1034616494006 常用快递编号:<br /> 15EMS,56申通,57顺丰,77圆通, 80韵达,87中通,85宅急送,62天天 1. class.base.php文件: <?php /** * 微信公众平台基础类 For Fshare * @author: S

php连接oracle数据库及查询数据的方法_php技巧

本文实例讲述了php连接oracle数据库及查询数据的方法.分享给大家供大家参考.具体分析如下: php有强大的功能不但可以支持mysql,mssql,mysqli之个我们还可以与oracle数据连接,要让php支持oracle非常的简单我们只要把php.ini中的;extention = php_oci8.dll分号去掉即可. php支持oracle连接函数 php.ini文件中的配置,去掉 ;extention = php_oci8.dll,去掉前面的分号,重启apache就可以了,如果不行

php连接odbc数据源并保存与查询数据的方法_php技巧

本文实例讲述了php连接odbc数据源并保存与查询数据的方法.分享给大家供大家参考. 具体实现代码如下: 复制代码 代码如下: $connstr = "driver=microsoft access driver (*.mdb);dbq=".realpath("db.mdb");     $connid = odbc_connect($connstr,"","",sql_cur_use_odbc); $odbc_exec =

PHP MYSQL实现登陆和模糊查询两大功能_php技巧

本文使用的软件版本如下:PHP版本 5.5.12:MYSQL版本 5.6.17:Apache 2.4.9 用的wampserver一.PHPMYSQL实现登陆 一共含有两个文件:login.php和logincheck.php;表单代码: <form action="logincheck.php"method="post"> Yonghu:<inputtype="text" name="username" /

php动态添加url查询参数的方法_php技巧

本文实例讲述了php动态添加url查询参数的方法.分享给大家供大家参考.具体分析如下: 这段代码可以动态为url添加key-value查询参数,如果参数已经存在则会用新的进行覆盖 function add_querystring_var($url, $key, $value) { $url=preg_replace('/(.*)(?|&)'.$key.'=[^&]+?(&)(.*)/i','$1$2$4',$url.'&'); $url=substr($url,0,-1);

php常用数组array函数实例总结【赋值,拆分,合并,计算,添加,删除,查询,判断,排序】_php技巧

本文实例总结了php常用数组array函数.分享给大家供大家参考,具体如下: array_combine 功能:用一个数组的值作为新数组的键名,另一个数组的值作为新数组的值 案例: <?php $a = array("one","two","three"); $b = array("一","二","三"); $c = array_combine($a,$b); print_r($c