本文整理匯總了PHP中Device::deviceInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Device::deviceInfo方法的具體用法?PHP Device::deviceInfo怎麽用?PHP Device::deviceInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Device
的用法示例。
在下文中一共展示了Device::deviceInfo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: die
$row = mysqli_fetch_array($res);
$result=$result."\"".$row[1]."\", \"name\": \"".$row[2]."\", \"mode\": [";
$query1="select name, template_alt from modes where template=".$row[3];
$res = mysqli_query($con,$query1) or die("Bad SQL");
$first=true;
while($row = mysqli_fetch_array($res)) {
if(!$first) $result=$result.", ";
$result=$result." { \"name\": \"".$row[0]."\", \"id\": \"".$row[1]."\"}";
$first=false;
}
$result = $result."]}"; */
$result = $device->deviceInfo($jsonObj->id, $jsonString->user);
} elseif ($cmd == 'list') {
$result = $device->listDevice($jsonString->user);
$jsonObject = json_decode($result);
$list = $jsonObject->devicelist;
$result = "{\"devicelist\": [";
$first = true;
foreach ($list as $item) {
if (!$first) {
$result = $result . ", ";
} else {
$first = false;
}
$result = $result . "" . $device->deviceInfo($item->id, $jsonString->user);
}
$result = $result . "]}";
示例2: elseif
} elseif ($cmd == 'read') {
if (isset($jsonString->date)) {
$d = $jsonString->date;
} else {
$d = shell_exec("date \"+%Y%m%d %H:%M:%S\"");
}
$result = $device->read($jsonString->user, $jsonString->device, $d);
} elseif ($cmd == 'getload') {
$result = $device->getload($jsonString->template, $jsonString->unit);
} elseif ($cmd == 'getprofile') {
$result = $device->getprofile($jsonString->deviceid, $jsonString->mode);
} elseif ($cmd == 'getprediction') {
$result = $device->getprediction($jsonString->template, $jsonString->unit);
} elseif ($cmd == 'readinterval') {
$result = $device->readInterval($jsonString->user, $jsonString->device, $jsonString->date1, $jsonString->date2);
} elseif ($cmd == 'info') {
$result = $device->deviceBehaviour($jsonString->device, $jsonString->user);
} elseif ($cmd == 'deviceinfo') {
$result = $device->deviceInfo($jsonString->device, $jsonString->user);
} elseif ($cmd == 'samples') {
$result = $device->samples($jsonString->device, $jsonString->date, $jsonString->template);
} elseif ($cmd == 'set') {
$result = $device->set($jsonString->device, $jsonString->parameters);
} else {
$result = "{'error': 'unsupported command'}";
}
if (isset($_GET['standard'])) {
$result = strtr($result, array("'" => '"'));
}
echo $result;
}