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


PHP Chat::getUsersByRoomId方法代码示例

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


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

示例1:

<?php

$type = $this->tokens[2];
$room_name = $this->tokens[3];
$last_message_id = (int) $this->tokens[4];
$name = $_POST['name'];
$status = (int) $_POST['status'];
$room = Chat::getRoomByName($room_name);
if (!$room) {
    $this->error = 'Invalid room name';
    return;
}
Chat::putMessages($room['room_id'], $name, $_POST['messages']);
Chat::updateUserInRoom($room['room_id'], $name, $status);
$messages = Chat::getMessagesSinceId($room['room_id'], $last_message_id);
$users = Chat::getUsersByRoomId($room['room_id']);
$this->json->commands = Chat::getCommands();
$this->json->last_message_id = Chat::$last_message_id;
$this->json->messages = $messages;
$this->json->users = $users;
开发者ID:richtaur,项目名称:chat,代码行数:20,代码来源:api_get.php

示例2: array_shift

array_shift($dates);
array_shift($dates);
array_shift($dates);
$date = implode('/', $dates);
if (!$this->room_name) {
    return 'error';
}
$this->room = Chat::getRoomByName($this->room_name);
if ($this->room) {
    if ($history) {
        $this->page_title = $this->room['name'] . ' history';
        if ($date) {
            $this->messages = Chat::getMessagesByRoomIdAndDate($this->room['room_id'], $date);
        } else {
            $this->dates = Chat::getDatesByRoomId($this->room['room_id']);
        }
        return 'history';
    }
} else {
    $this->room = Chat::putRoom($this->room_name);
    if (is_string($this->room)) {
        $this->error_message = $this->room;
        return 'error';
    }
    $this->message = 'Room created! The code is <strong>' . $this->room['code'] . '</strong>. Keep it secret, keep it safe. Type <code>/help</code> for more info.';
}
$this->page_title = $this->room['name'];
$this->users = Chat::getUsersByRoomId($this->room['room_id']);
$this->messages = Chat::getMessagesByRoomId($this->room['room_id']);
$this->num_messages = Chat::getNumMessagesByRoomId($this->room['room_id']);
return 'room';
开发者ID:richtaur,项目名称:chat,代码行数:31,代码来源:room.php


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