php如何判断单双大小?比如采集调用号码为4,5,6,7,8 总和为 30 小于或等于22为小,大于为大, 由于三位4,6,8为双,二位5,7为单,所以为双,反之为单,如果为小就调用0,为大就调用1,单调用为0,双就调用为1!列如为大调用sumBigSmal“:1;”为双sumSingleDouble":1,"
<?php
//$js = file_get_contents('http://kai.kai800.net/getbaseruishi10mshicai?lotCode=10060');
//echo($js);
$servername = "localhost";
$username = "qxc";
$password = "123456";
$dbname = "qxc";
// 创建连接
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
$sql = "SELECT * FROM qxc.jz_data where type='7' order by number desc LIMIT 1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
$number=$row["number"];
$data=$row["data"];
$arr=$row["data"];
$num1=$arr[0]+$arr[1]+$arr[2]+$arr[3]+$arr[4]+$arr[5]+$arr[6]+$arr[7]+$arr[8];
$time=date('Y-m-d H:i:s',$row["time"]);
$drawTime=date('Y-m-d H:i:s',$row["time"]+180);
$serverTime=date('Y-m-d H:i:s');
$drawCount=substr($number,strlen($number)- 3,3);
}
} else {
}
$conn->close();
?>
{"errorCode":<?php echo ($num1);?>,"message":"\u64cd\u4f5c\u6210\u529f","result":{"businessCode":0,"message":"\u64cd\u4f5c\u6210\u529f","data":{"index":100,"serverTime":"<?php echo $serverTime;?>","totalCount":480,"lotName":"\u8377\u517010\u5206\u5f69","groupCode":2,"shelves":0,"iconUrl":"","lotCode":30004,"frequency":"","id":"41746","status":0,"preDrawCode":"<?php echo $data;?>","drawIssue":"<?php echo ($number+1);?>","drawTime":"<?php echo $drawTime;?>","preDrawTime":"<?php echo $time;?>","preDrawDate":"<?php echo $time;?>","firstNum":"4","secondNum":"7","thirdNum":"6","fourthNum":"8","fifthNum":"2","preDrawIssue":"<?php echo $number;?>","drawCount":<?php echo $drawCount;?>,"sumNum":<?php echo ($num1);?>,"sumBigSmall":0,"sumSingleDouble":0,"behindThree":3,"betweenThree":1,"dragonTiger":1,"fifthBigSmall":1,"fifthSingleDouble":1,"fourthBigSmall":0,"fourthSingleDouble":1,"thirdBigSmall":0,"thirdSingleDouble":1,"secondBigSmall":0,"secondSingleDouble":0,"firstBigSmall":1,"firstSingleDouble":1,"lastThree":1,"sdrawCount":""}}}