Пример #1
0
    $weather[$key] = $array4[$key]["cond"]["txt_n"];
    //这里会有个问题 晚上无法获取白天天气。
    $image[$key] = $array4[$key]["cond"]["code_n"];
}
$suggestion[] = $array6["comf"]["brf"] . "-" . $array6["comf"]["txt"];
$suggestion[] = $array6["cw"]["brf"] . "-" . $array6["cw"]["txt"];
$suggestion[] = $array6["drsg"]["brf"] . "-" . $array6["drsg"]["txt"];
$suggestion[] = $array6["flu"]["brf"] . "-" . $array6["flu"]["txt"];
$suggestion[] = $array6["sport"]["brf"] . "-" . $array6["sport"]["txt"];
$suggestion[] = $array6["trav"]["brf"] . "-" . $array6["trav"]["txt"];
$suggestion[] = $array6["uv"]["brf"] . "-" . $array6["uv"]["txt"];
//$tmp[0] = $array5[0]["tmp"];
$result = array("date" => $date, "time" => time(), "tmp" => $tmp, "weather" => $weather, "image" => $image, "suggestion" => $suggestion);
//var_dump(json_decode($res));
$info = new weather_info($result);
$add_info = new weather_infos_action();
$add_info->addinfo($info);
//$info->show();
//$result =  $info->value;
//foreach ($result as $key=>$items){
//    if(is_array($items)) {
//        foreach ($items as $key_i=>$item) {
//            print $key." ".$key_i." ".($item);
//            print "<br/>";
//        }
//    }else {
//        print $key . " " . ($items);
//        print "<br/>";
//    }
//}
echo $showtime = date("Y-m-d H:i:s");
Пример #2
0
<?php

//include "bx.php";
header("Content-type:text/html;charset=UTF-8");
require_once "weather_infos_action.php";
require_once "calendar/cal_action.php";
require_once 'guys.php';
$w_info = new weather_infos_action();
$info = $w_info->getrecentinfo()->value;
$weather = $info["weather"];
$tmp = $info["tmp"];
$tmp_max = array();
$tmp_min = array();
foreach ($tmp as $item) {
    $arr = explode("-", $item);
    $tmp_max[] = $arr[0];
    $tmp_min[] = $arr[1];
}
$img = $info["image"];
$week_array = array("日", "一", "二", "三", "四", "五", "六");
$week = array();
for ($i = 0; $i < 7; $i++) {
    $week[] = "星期" . $week_array[(date("w") + $i) % 7];
}
$date = $info["date"];
$suggest = $info["suggestion"];
$week_calendar = sel_calender($date);
$calendar_everyday = array();
/*
foreach ($week_calendar as $item){
    $day = (strtotime($item->start)-strtotime($date))/3600/24 ;
Пример #3
0
            $this->weather2 = $info['weather'][1];
            $this->weather3 = $info['weather'][2];
            $this->weather4 = $info['weather'][3];
            $this->weather5 = $info['weather'][4];
            $this->weather6 = $info['weather'][5];
            $this->weather7 = $info['weather'][6];
            $this->img1 = $info['image'][0];
            $this->img2 = $info['image'][1];
            $this->img3 = $info['image'][2];
            $this->img4 = $info['image'][3];
            $this->img5 = $info['image'][4];
            $this->img6 = $info['image'][5];
            $this->img7 = $info['image'][6];
            $this->index1 = $info['suggestion'][0];
            $this->index2 = $info['suggestion'][1];
            $this->index3 = $info['suggestion'][2];
            $this->index4 = $info['suggestion'][3];
            $this->index5 = $info['suggestion'][4];
            $this->index6 = $info['suggestion'][5];
            $this->index7 = $info['suggestion'][6];
        }
    }
}
require_once '../sdk.php';
require_once "../../weather_infos_action.php";
//数据库登录信息
$weather_act = new weather_infos_action("127.0.0.1", "root", "", "BaixingWeather_db");
$recent_info = new info_to_andriod($weather_act->getrecentinfoArray());
//$recent_info=new info_to_andriod();
$msg_des = json_encode($recent_info);
//echo $msg_des;