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


PHP Chat::gravatarFromHash方法代码示例

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


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

示例1: getChats

 public static function getChats($lastID)
 {
     $lastID = (int) $lastID;
     $result = DB::query('SELECT * FROM webchat_lines WHERE id > ' . $lastID . ' ORDER BY id ASC');
     $chats = array();
     while ($chat = $result->fetch_object()) {
         $chat->time = array('hours' => gmdate('H', strtotime($chat->ts)), 'minutes' => gmdate('i', strtotime($chat->ts)));
         $chat->gravatar = Chat::gravatarFromHash($chat->gravatar);
         $chats[] = $chat;
     }
     return array('chats' => $chats);
 }
开发者ID:tcarmet,项目名称:Piscine_php,代码行数:12,代码来源:Chat.class.php

示例2: actionChat

 public function actionChat()
 {
     $dbOptions = array('db_host' => 'localhost', 'db_user' => 'root', 'db_pass' => '', 'db_name' => 'ot');
     session_name('webchat');
     session_id(rand(1, 5));
     if (get_magic_quotes_gpc()) {
         // If magic quotes is enabled, strip the extra slashes
         array_walk_recursive($_GET, create_function('&$v,$k', '$v = stripslashes($v);'));
         array_walk_recursive($_POST, create_function('&$v,$k', '$v = stripslashes($v);'));
     }
     try {
         // Connecting to the database
         //$db = new DB;
         $chat = new Chat();
         //DB::init($dbOptions);
         $response = array();
         // Handling the supported actions:
         switch ($_GET['action']) {
             case 'login':
                 $response = array('status' => 1, 'name' => Yii::app()->user->name, 'gravatar' => Chat::gravatarFromHash('123'));
                 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())));
     }
 }
开发者ID:nguyendvphp,项目名称:onlinetraining,代码行数:44,代码来源:WLectureController.php


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