本文整理汇总了PHP中Gateway::isOnline方法的典型用法代码示例。如果您正苦于以下问题:PHP Gateway::isOnline方法的具体用法?PHP Gateway::isOnline怎么用?PHP Gateway::isOnline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gateway
的用法示例。
在下文中一共展示了Gateway::isOnline方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/Workerman/Autoloader.php';
require_once dirname(dirname(__DIR__)) . '/GatewayClient/Gateway.php';
\Workerman\Autoloader::setRootPath(__DIR__ . '/../../');
use GatewayWorker\Lib\Db;
use Workerman\Protocols\Http;
if (!isset($_POST['macid']) && !isset($_POST['buttonid'])) {
echo "对不起,您访问的页面不存在!";
HTTP::end();
}
$macid = $_POST['macid'];
$buttonid = $_POST['buttonid'];
$connectHC = Db::instance('ConnectHC');
$clientdata = $connectHC->row("SELECT clientid, sign FROM `WEBHC` WHERE macid='{$macid}'");
if (!Gateway::isOnline($clientdata['clientid'])) {
echo "102";
HTTP::end();
}
if (!$clientdata['sign']) {
echo "103";
HTTP::end();
}
Gateway::sendToClient($clientdata['clientid'], "{" . $buttonid . "}");
echo "101";
HTTP::end();
?>
示例2: dirname
<?php
require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/Workerman/Autoloader.php';
require_once dirname(__DIR__) . '/redisData.php';
require_once dirname(dirname(__DIR__)) . '/GatewayClient/Gateway.php';
\Workerman\Autoloader::setRootPath(__DIR__ . '/../../');
use Workerman\Protocols\Http;
use GatewayWorker\Lib\Db;
HTTP::sessionStart();
if (isset($_POST['username'])) {
$username = $_POST['username'];
$macid = $_POST['macid'];
$text = $_POST['text'];
$connectHC = Db::instance('ConnectDb');
$clientid = $connectHC->row("SELECT clientid FROM `wifiserver` WHERE macid='{$macid}'");
if (Gateway::isOnline($clientid['clientid'])) {
//判断设备是否在线
if (!isset($_SESSION['login'])) {
echo "103";
} else {
Gateway::sendToClient($clientid['clientid'], $text);
echo "101";
}
} else {
echo "102";
}
} else {
echo "对不起,您访问的页面不存在!:(";
HTTP::end();
}