public function page() { header("Content-type: text/html; charset=utf-8"); $page = new Page(100, 10); //参数1:总条数,参数2:每页显示条数 $page->setStyle(1); echo $pageStr = $page->getPageStr(); }
public function getTmpLog() { $pageId = max(intval($_GET['page']), 1); //http://admin.alarm.mix.sina.com.cn/?s=redis_tmp_log&a=get_tmp_log&_search_field=type&_search_keyword=1 $type = $_GET['_search_keyword']; $limit = 50; $start = ($pageId - 1) * $limit; $stop = $start + $limit; $tmpLog = MyRedis::getTmpLog($type, $start, $stop); $pageModel = new Page($tmpLog['count'], $limit); $this->setView('_search_keyword', $type); $this->setView('messages', $tmpLog['messages']); $this->setView('pageStr', $pageModel->getPageStr()); $this->display('RedisTmpLog.html'); }
public function view() { $key = isset($_GET['key']) ? $_GET['key'] : ''; $pageId = isset($_GET['page']) ? max(intval($_GET['page']), 1) : 1; if (empty($key)) { Message::showError('项目key不能为空'); } $limit = 50; $host = '172.16.53.68'; $port = 6381; $rd = new Redis(); $rd->connect($host, $port); $count = $rd->lsize($key); $data = $rd->lRange($key, $limit * ($pageId - 1), $limit * $pageId); $data = array_map('unserialize', $data); Common::debug($data); // $data = unserialize($data); // Common::debug($data);exit; $pageModel = new Page($count, $limit); $this->setView('data', $data); $this->setView('pageStr', $pageModel->getPageStr()); $this->display('XhprofLog.html'); }
//没有选择商城,则默认全部商城被选中 $mallStr .= "<a href=\"./index.php?id=" . $c_id . "\" class=\"curcateitem\"><span class=\"curcateitemword\">全部</span></a>"; } else { $mallStr .= "<a href=\"./index.php?id=" . $c_id . "\" class=\"cateitem\"><span class=\"cateitemword\">全部</span></a>"; } for ($i = 0; $i < count($sources); $i++) { if ($mall_id == $i + 1) { //商城id对应则显示该分类被选中 $mallStr .= "<a href=\"./index.php?id=" . $c_id . "&mall_id=" . ($i + 1) . "\" class=\"curcateitem\"><span class=\"curcateitemword\">" . $sources[$i]['mallName'] . "</span></a>"; } else { $mallStr .= "<a href=\"./index.php?id=" . $c_id . "&mall_id=" . ($i + 1) . "\" class=\"cateitem\"><span class=\"cateitemword\">" . $sources[$i]['mallName'] . "</span></a>"; } } $_SESSION['uri'] = $_SERVER['REQUEST_URI']; //接受商品列表显示页码 $page = isset($_GET['page']) ? $_GET['page'] : 1; $pagecount = $config['pagecount']; //获取该类商品的总记录数 $goods = new Goods(); $counts = $goods->getCartGoodsCounts($c_id)['c']; $pages = ceil($counts / $pagecount); //对用户传递$page进行判断 if (!is_numeric($page) || $page > $pages || $page < 1) { $page = 1; } $cartGoods = $goods->getGoodsByCartId($c_id, $page, $pagecount); //分页显示 //分页链接字符串 $pageString = Page::getPageStr('index.php', 'index', $counts, $page, $pagecount, $c_id); //加载首页显示模板 include_once YIMAI_TEMP . 'index.html';
public function getDetail() { $pid = intval($_GET['pid']); if (!$pid) { $projectDB = new ProjectModelDB(); $pid = $projectDB->getFirst('SELECT id FROM `' . $projectDB->getTableName() . '` WHERE name=?', array($_GET['pname'])); } $pageId = max(intval($_GET['page']), 1); $limit = 50; $start = ($pageId - 1) * $limit; $stop = $start + $limit; $detail = MyRedis::getProjectDetail($pid, $start, $stop); $data = array(); foreach ($detail['messages'] as $i => $v) { if (($msg = @unserialize($v)) && is_array($msg)) { $data[$i] = $msg; } else { $msg = explode(" ", $v); $data[$i]['time'] = str_replace(array('[', ']'), '', array_shift($msg) . ' ' . array_shift($msg)); $data[$i]['name'] = array_shift($msg); $data[$i]['code'] = str_replace(array("错误号:", '{', '}'), '', array_shift($msg)); $otherMsg = array_pop($msg); $otherMsgArr = explode(",", $otherMsg); if (count($otherMsgArr) == 4) { $data[$i]['xhprofId'] = str_replace(array('xhprofId[', ']'), '', array_pop($otherMsgArr)); } list($data[$i]['clientIp'], $data[$i]['serverIp']) = explode("/", str_replace(array("来自"), '', array_pop($otherMsgArr))); $data[$i]['email'] = str_replace(array("短信:", '第', '次'), '', array_pop($otherMsgArr)); $data[$i]['sms'] = str_replace(array("邮件:", '第', '次'), '', array_pop($otherMsgArr)); $data[$i]['message'] = str_replace(array("详细:"), '', implode(" ", $msg)); } } Common::debug($data, 'Result'); $pageModel = new Page($detail['count'], $limit); $this->setView('pageTitle', '详细信息'); $this->setView('data', $data); $this->setView('pageStr', $pageModel->getPageStr()); $this->display('Detail.html'); }