本文整理汇总了PHP中Chat::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::getMessage方法的具体用法?PHP Chat::getMessage怎么用?PHP Chat::getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chat
的用法示例。
在下文中一共展示了Chat::getMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Chat
//include_once 'Chat.php';
#$data = '{"action": "getmsg", "phone": "2347066192100"}';
#$data = '{"action":"receiverstatusmsg","receiver":"2348105364269","status":"w"}';
#$data = '{"action":"msgbystatus","phone":"2347066192100","status":"r
#$data = '{"action":"msgbychatkey","chatkey":"23470661921002348105364269"}'
# $data = '{"action": "update", "authkey": "770073e57a7fcf79760c1555bdc5a908","fname":"Jo","lname":"Ogbimi","email":"jogbims@yahoo.com","photo":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCABkAGQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19"}';
#$data = 'http://83.138.190.170/fuse/chat.php?json={%22action%22:%22sendmessage%22,%22msgid%22:%222347%22,%22chatkey%22:%2223470661921002348105364269%22,%22authkey%22:%22770073e57a7fcf79760c1555bdc5a908%22,%22sender%22:%222347066192100%22,%22receiver%22:%222348105364269%22,%22msgtype%22:%22text%22,%22msg%22:%22hello%20there%22,%22status%22:%22w%22}';
#exit;
$chat = new Chat();
switch ($action) {
case 'sendmessage':
App::setJSONResponse($chat->sendMessage($request['chatkey'], $request['authkey'], $request['sender'], $request['receiver'], $request['contenttype'], $request['msgcontent'], $request['msgstatus']));
#App::setJSONResponse($chat->sendMessage($request['msgid']));
break;
case 'getmsg':
App::setJSONResponse($chat->getMessage($request['phone']));
#App::setJSONResponse($chat->getMessage());
break;
case 'msgbystatus':
App::setJSONResponse($chat->getMessageByStatus($request['phone'], $request['status']));
break;
case 'receivermsg':
App::setJSONResponse($chat->getreceiverMessage($request['receiver'], $request['id']));
break;
case 'receiverstatusmsg':
App::setJSONResponse($chat->getReceiverMsgByStatus($request['receiver'], $request['status']));
break;
case 'msgbychatkey':
App::setJSONResponse($chat->getMsgByChatKey($request['chatkey']));
break;
case 'msgbyauthkey':
示例2: array
if ($user->isLogin() !== true) {
echo $errorResponse = json_encode(array("status" => false, "message" => array("errorCode" => -4, "errorMessage" => "User not login.")));
exit(0);
}
if (@isset($_GET['action'])) {
$action = $_GET['action'];
if ($action === 'send') {
$chat = new Chat();
if (@isset($_POST['to']) && isset($_POST['message'])) {
$to = $_POST['to'];
$message = $_POST['message'];
echo json_encode($chat->addMessage($user->getUsername(), $to, $message, date('Y-m-d H:i:s', time())));
exit(0);
} else {
echo $errorResponse = json_encode(array("status" => false, "message" => array("errorCode" => -16, "errorMessage" => "No user for to or no message.")));
}
} else {
if ($action === 'get') {
$chat = new Chat();
if (@isset($_POST['to'])) {
$to = $_POST['to'];
echo json_encode($chat->getMessage($user->getUsername(), $to));
exit(0);
} else {
echo $errorResponse = json_encode(array("status" => false, "message" => array("errorCode" => -8, "errorMessage" => "the user for to is not find.")));
}
}
}
} else {
echo $errorResponse = json_encode(array("status" => false, "message" => array("errorCode" => -12, "errorMessage" => "Nothing to do.")));
}