当前位置: 首页>>代码示例>>PHP>>正文


PHP Device::get_all_devices方法代码示例

本文整理汇总了PHP中Device::get_all_devices方法的典型用法代码示例。如果您正苦于以下问题:PHP Device::get_all_devices方法的具体用法?PHP Device::get_all_devices怎么用?PHP Device::get_all_devices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Device的用法示例。


在下文中一共展示了Device::get_all_devices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Device

include_once 'includes/dbcon.php';
include_once 'includes/device.php';
$deviceObj = new Device();
if (isset($_POST["device"])) {
    $device = $_POST["device"];
    $result = $deviceObj->get_components($device);
    $controls = $result['details'];
    $controls = substr($controls, 0, strlen($controls) - 1);
    $controlsArray = explode("!", $controls);
    //$controls = //TubeLight:12!RedLight:11!Fan:10!
    foreach ($controlsArray as $control) {
        $controlArray = explode(":", $control);
        echo "<option value=" . $controlArray[1] . ">" . $controlArray[0] . "</option>";
    }
} else {
    $list = $deviceObj->get_all_devices();
    echo "<option class='redClass' value='0'>Select a device</option>";
    foreach ($list as $item) {
        echo "<option value=" . $item['name'] . ">" . $item['name'] . "</option>";
    }
}
/*echo "<input id='ip' hidden value='". $ip."'>";
	
		$result = $deviceObj->get_controls($ip);
		$controls = $result['details'];
		$controls = substr($controls,0,strlen($controls)-1);
		$controlsArray = explode("!",$controls);   

		//$controls = //TubeLight:12!RedLight:11!Fan:10!
		echo "<table  align='center' id='controlList'>";
开发者ID:CyberLeito,项目名称:IoT_Web,代码行数:30,代码来源:getDevices.php

示例2: Device

<?php

include_once 'includes/dbcon.php';
include_once 'includes/device.php';
$deviceObj = new Device();
$devices = $deviceObj->get_all_devices();
echo "<tr>\n\t\t<th>Device ID</th>\n\t\t<th>Type</th>\n\t\t<th>IP address</th>\n\t\t<th>Action</th>\n\t    </tr>";
foreach ($devices as $dev) {
    echo "<tr>\n\t\t\t\t<td>" . $dev['name'] . "</td>\n\t\t\t\t<td>" . $dev['type'] . "</td>\n\t\t\t\t<td>" . $dev['ip'] . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<form action='devices.php' method='post'>\n\t\t\t\t\t\n\t\t\t\t\t\t<input hidden type='text' name='dName' value='" . $dev['name'] . "'> \n\t\t\t\t\t  \t<input type='submit' value='Open'>\n\t\t\t\t\t</form> \n\t\t\t\t</td>\n\t\t\t</tr>";
}
//<input hidden type='text' name='ip' value='".$dev['ip']."'> //changing ip to name
//<button onclick=\"location.href = 'devices.php?ip=".$dev['ip']."';\">Check</button>
//$file = 'connections.txt';
//$data = file_get_contents($file);
//	$dataArr = explode("<br>", $data);
/*
	foreach ($dataArr as $device) {
		if($device!=null){
			$deviceArr = explode("/", $device);
			echo "<tr>
					<td>Device 1</td>
					<td>".$deviceArr[0]."</td>
					<td>
						<button onclick=\"location.href = 'device.php?ip=$deviceArr[0]';\">Check</button>
					</td>
				</tr>";
		}
		
	}*/
开发者ID:CyberLeito,项目名称:IoT_Web,代码行数:29,代码来源:view.php


注:本文中的Device::get_all_devices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。