本文整理匯總了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();
}