xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 1.51KB
    文件類型: .php
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-01-29
  • 標(biāo)簽: php??hp??POS??POST????

資源簡(jiǎn)介

<?php

ini_set('display_errors', 'Off');//是否顯示錯(cuò)誤信息

//訪問(wèn)后臺(tái)mysql數(shù)據(jù)庫(kù)
$db = new mysqli('localhost','root','key','database_name');
if(mysqli_connect_errno())
{
echo "與數(shù)據(jù)庫(kù)連接失敗,請(qǐng)檢查相關(guān)配置。";
exit;
}

date_default_timezone_set('Asia/Shanghai');//選擇默認(rèn)時(shí)區(qū),亞洲中國(guó)地區(qū)的時(shí)區(qū)為上海時(shí)間
$currtime = date("Y-m-d H:i:s");//獲取數(shù)據(jù)接收的時(shí)間

$json = $HTTP_RAW_POST_DATA;//接收客戶端POST的數(shù)據(jù)
$obj = json_decode($json);//解析JSON數(shù)據(jù)
$s = $obj->s;
$t = $obj->t;
$num = count($s);//得到S數(shù)組長(zhǎng)度
for($i=0;$i<$num;$i )
{
$x = $s[$i]->x;
$y = $s[$i]->y;
$z = $s[$i]->z;

//將解析后的數(shù)據(jù)插入到數(shù)據(jù)庫(kù)
if($t !== null)//數(shù)據(jù)插入數(shù)據(jù)庫(kù)的約束條件
{
$query = "INSERT INTO data_table VALUES ('".$t."','".$currtime."','".$x."','".$y."','".$z."')";//SQL語(yǔ)句
$result = $db -> query($query);
}
}
$db -> close();

echo $json;//It's very important when you debug your code.

?>

資源截圖

代碼片段和文件信息


ini_set(‘display_errors‘?‘Off‘);//是否顯示錯(cuò)誤信息

//訪問(wèn)后臺(tái)mysql數(shù)據(jù)庫(kù)
$db?=?new?mysqli(‘localhost‘‘root‘‘key‘‘database_name‘);
if(mysqli_connect_errno())
{
echo?“與數(shù)據(jù)庫(kù)連接失敗,請(qǐng)檢查相關(guān)配置。“;
exit;
}

date_default_timezone_set(‘Asia/Shanghai‘);//選擇默認(rèn)時(shí)區(qū),亞洲中國(guó)地區(qū)的時(shí)區(qū)為上海時(shí)間
$currtime?=?date(“Y-m-d?H:i:s“);//獲取數(shù)據(jù)接收的時(shí)間

$json?=?$HTTP_RAW_POST_DATA;//接收客戶端POST的數(shù)據(jù)
$obj?=?json_decode($json);//解析JSON數(shù)據(jù)
$sensor?=?$obj->sensor;
$timestamp?=?$obj->timestamp;
$guid?=?$obj->guid;
$num?=?count($sensor);//得到Sensor數(shù)組長(zhǎng)度
for($i=0;$i<$num;$i++)
{
$index?=?$sensor[$i]->index;
$hr?=?$sensor[$i]->hr;
$x?=?$sensor[$i]->x;
$y?=?$sensor[$i]->

評(píng)論

共有 條評(píng)論