本文整理汇总了PHP中Chat::submitChat方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::submitChat方法的具体用法?PHP Chat::submitChat怎么用?PHP Chat::submitChat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chat
的用法示例。
在下文中一共展示了Chat::submitChat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// Connecting to the database
DB::init($dbOptions);
$response = array();
// Handling the supported actions:
switch ($_GET['action']) {
case 'login':
$response = Chat::login($_POST['name'], $_POST['email']);
break;
case 'checkLogged':
$response = Chat::checkLogged();
break;
case 'logout':
$response = Chat::logout();
break;
case 'submitChat':
$response = Chat::submitChat($_POST['chatText']);
break;
case 'getUsers':
$response = Chat::getUsers();
break;
case 'getChats':
$response = Chat::getChats($_GET['lastID']);
break;
default:
throw new Exception('Wrong action');
}
echo json_encode($response);
} catch (Exception $e) {
die(json_encode(array('error' => $e->getMessage())));
}
?>
示例2: array
// Connecting to the database
DB::init($dbOptions);
$response = array();
// Handling the supported actions:
switch ($_GET['action']) {
case 'login':
$response = Chat::login($_POST['name'], $_POST['email'], $_POST['user']);
break;
case 'checkLogged':
$response = Chat::checkLogged();
break;
case 'logout':
$response = Chat::logout();
break;
case 'submitChat':
$response = Chat::submitChat($_POST['chatText'], $_POST['room'], $_POST['room_od']);
break;
case 'getUsers':
$response = Chat::getUsers();
break;
case 'getChats':
$response = Chat::getChats($_GET['lastID'], $_GET['room'], $_GET['room_od']);
break;
default:
throw new Exception('Error');
}
if ($_GET['action'] == "getChats") {
echo emot(json_encode($response));
} else {
echo json_encode($response);
}