这个是参照了别人的网站, 有点分层的意识..
下面把代码粘出来保存.
Index.php
<?php Header ( "Content-type: text/vnd.wap.wml;charset=utf-8" ); Header ( "Cache-Control: no-cache, must-revalidate" ); Header ( "Pragma: no-cache" ); require_once 'operateDB.php'; //得到相关参数 if (empty ( $action )) { $action = $_POST [action]; if ($action == '') { $action = $_GET [action]; if ($action == '') { $action = 'loginform'; } } } $operatordb = new RegisteModule(); switch ($action) { case 'loginform' : include 'login.wml'; break; case 'login' : //设置相关参数 $result = $operatordb->ValidateUser($_POST[username],$_POST[userpass]); //print_r($result[ValidUserResult]); if($result->ValidUserResult == -1){ //登陆失败 $loginresult = "你输入的用户名或密码为误,请重新输入:"; include 'login.wml'; }else{ //登陆成功,在导入index页面前先得把要显示在index页面的信息 include 'beamToIndex.wml'; } break; case 'index' : //根据提供相关参数,获取全部分类及最新文章列表 $userid = $_GET[userid]; $categoryListResult = $operatordb->getCategoryAllList(); $newsTopArticle = $operatordb->getLastArtilces(); include 'index.wml'; break; case 'list' : //得到相关分类列表 $userid = $_GET[userid]; $categoryinfo = $operatordb->getCategoryInfo($_GET[categoryID]); $articleListByCategoryID = $operatordb->getArticleListByCategoryID($_GET[categoryID]); //得到分页信息 if(isset($_GET[page])){ $page = $_GET[page]; }else{ $page = 1; } $list_rows = 20; include 'list.wml'; break; case 'article' : $userid = $_GET[userid]; //得到文章详细信息和相关评论 $categorys = $operatordb->getCategoryIDByArticleID($_GET[articleID]); //$categoryinfo = $operatordb->getCategoryInfo($_GET[categoryID]); $articleInfo = $operatordb->getArticleByArticleID($_GET[articleID]); $commentListByArticleID = $operatordb->getCommentListByArticleID($_GET[articleID]); include 'article.wml'; break; case 'addComment' : if($_POST[userid]==''){ include 'beamToLogin.wml'; }else{ $userid = $_POST[userid]; $articleid = $_POST[articleid]; $comment = $_POST[comment]; $result = $operatordb->publicComments($articleid,$userid,$comment); include 'beamToArticle.wml'; } break; } ?>
Index.wml
<?php //require_once("page_list.php"); echo '<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <head> <meta http-equiv="Cache-Control" content="max-age=7" forua="true"/> <meta http-equiv="content-type" content="text/vnd.wap.wml;charset=UTF-8"/> </head> <card id="main" title="TimeSheet"> <p><a href="index.php" mce_href="index.php">主页</a> 欢迎使用手机网</p>'; //读取数据库中的分类信息,放在一行中 echo '<p>'; for($i=0;$i<count($categoryListResult->GetCategoryListFromNewsArticlesResult->CategoryInfo);$i++){ echo '<a href="index.php?action=list&categoryID='.$categoryListResult->GetCategoryListFromNewsArticlesResult->CategoryInfo[$i]->CategoryID. '&userid='.$userid.'">' . $categoryListResult->GetCategoryListFromNewsArticlesResult->CategoryInfo[$i]->Name."</a> "; } echo '</p>'; //显示最新更新的二十条记录 for($i=0;$i<count($newsTopArticle->GetLastArtilcesListResult->sArticleInfo);$i++){ echo '<p><a href="index.php?action=article&articleID='. $newsTopArticle->GetLastArtilcesListResult->sArticleInfo[$i]->ArticleID .'&userid='.$userid.'">'. $newsTopArticle->GetLastArtilcesListResult->sArticleInfo[$i]->Title.'</a></p>'; } echo ' </card> </wml> '; ?>
List.wml
<?php require_once("page_list.php"); require_once("wap.inc.php"); echo '<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <head> <meta http-equiv="Cache-Control" content="max-age=7" forua="true"/> <meta http-equiv="content-type" content="text/vnd.wap.wml;charset=UTF-8"/> </head> <card id="main" title="TimeSheet '.$categoryinfo->fields[1].'">'; echo '<p><a href="index.php?action=list&categoryID='.$categoryinfo->GetCategoryInfoResult->CategoryID.'&userid='.$_GET[userid].'">'.$categoryinfo->GetCategoryInfoResult->Name.'</a> <a href="index.php?action=index&userid='.$_GET[userid].'" mce_href="index.php?action=index&userid='.$_GET[userid].'">返回主页</a></p>'; //count($articleListByCategoryID->GetArtilcesListFromNewsArticlesResult->sArticleInfo) for($i=(($page-1)*$list_rows);$i<(($page*$list_rows)-1);$i++){ echo '<p><a href="index.php?action=article&categoryID='. $categoryinfo->GetCategoryInfoResult->CategoryID.'&articleID=' .$articleListByCategoryID->GetArtilcesListFromNewsArticlesResult->sArticleInfo[$i]->ArticleID .'&userid='.$_GET[userid].'">' .ConvertStr($articleListByCategoryID->GetArtilcesListFromNewsArticlesResult->sArticleInfo[$i]->Title).'</a></p>'; } $pages = new page_list(); $pages->display(count($articleListByCategoryID->GetArtilcesListFromNewsArticlesResult->sArticleInfo),$list_rows,$page, 'index.php?action=list&categoryID='.$categoryinfo->GetCategoryInfoResult->CategoryID .'&userid='.$_GET[userid]); echo ' </card> </wml> '; ?>
Login.wml
<?php echo '<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <head> <meta http-equiv="Cache-Control" content="max-age=7" forua="true"/> <meta http-equiv="content-type" content="text/vnd.wap.wml;charset=UTF-8"/> </head> <card id="title" title="手机网登陆"> <p><font color="red">'.iconv("gbk","utf-8",$loginresult).'</font></p> <p>Username: <input type="text" name="username"/> <br/> Userpass: <input type="password" name="userpass"/> <br/> <anchor>提交 <go href="index.php" mce_href="index.php" method="post"> <postfield name="action" value="login"/> <postfield name="username" value="$(username)"/> <postfield name="userpass" value="$(userpass)"/> </go> </anchor> </p> </card> </wml> '; ?>
Page_list.php
<?php //require_once("wap.inc.php"); class page_list{ var $total_page; //总页面数 var $now_page; //当前页面 var $list_page; //前一页 var $next_page; //下一页 //计算总页面数,$rows 总记录数 , $list_rows 每页显示条数 function totalpage($rows,$list_rows){ $this->total_page = ceil($rows/$list_rows); $nums = $this->total_page; return $nums; } //计算当前页 function nowpage($page){ if(!isset($page) || $page <= 1){ $this->now_page = 1; }else{ $this->now_page = $page; } $pages = $this->now_page; return $pages; } //显示上一页,下一页 /* * rows 总记录 * list_rows 每页显示数目 * page 当前页 * url 跳转页面 */ function display($rows,$list_rows,$page,$url){ $page = $this->nowpage($page); $this->list_page = $page-1; $this->next_page = $page+1; if($this->nowpage($page)==1){ echo iconv("gbk","utf-8",'共'.$this->totalpage($rows,$list_rows).'页 | ' .'第1页 |' .'<a href="'.$url.'&page='.$this->next_page.'">'.'下一页 '.'</a>|'); }else if($this->nowpage($page)==$this->totalpage($rows,$list_rows)){ echo iconv("gbk","utf-8",'共'.$this->totalpage($rows,$list_rows).'页 | ' .'<a href="'.$url.'&page='.$this->list_page.'">'.'上一页 </a>|' .' 最后一页' ); }else{ echo iconv("gbk","utf-8",'共'.$this->totalpage($rows,$list_rows).'页' .'<a href="'.$url.'&page='.$this->list_page.'">'.'上一页 </a>| ' .'第'.$this->nowpage($page).'页 | ' .'<a href="'.$url.'&page='.$this->next_page.'">'.'下一页'.'</a> |'); } } } ?>
前端面試題 - redux與vuex的區別? redux使用的是不可變數據,每次都是用新的state替換舊的state,通過diff算法比較差異的;而Vuex是可變的,通過getter/setter直接修改。 另外就是在api上有不同,v
protected function getNode(){ //$CONTROLLER_NAME = $this->_CI->router->fetch_class(); //$ACTION_NAME = $this->_
List 是Java中非常常用的數據類型。 List 是有序的 Collection。 Java List 一共三個實現類:分別是 ArrayList、 Vector 和 LinkedList。 ArrayList(數組) Array
本文分享自華爲雲社區《重磅新品發佈!雲耀數據庫HRDS,享受輕量級的極致體驗!》,作者:GaussDB 數據庫。 所謂,凡有井水處,即能歌柳詞。 大數據時代,凡有數據處,必有數據庫。 隨着業務需求的不斷擴大和數據量的激增,數
結構特點 List 和 Set 是存儲單列數據的集合,Map 是存儲鍵和值這樣的雙列數據的集合;List 中存儲的數據是有順序,並且允許重複;Map 中存儲的數據是沒有順序的,其鍵是不能重複的,它的值是可以有重複的,Set 中存儲的數據
「列表 list」是一個抽象的數據結構概念,它表示元素的有序集合,支持元素訪問、修改、添加、刪除和遍歷 等操作,無須使用者考慮容量限制的問題。列表可以基於鏈表或數組實現。 ‧ 鏈表天然可以看作一個列表,其支持元素增刪查改操作
簡介: 搶紅包是我們生活常用的社交功能, 這個功能最主要的特點就是用戶的併發請求高, 在系統設計上, 可以使用非常多的辦法來扛住用戶的高併發請求, 在本文中簡要介紹使用Redis緩存中間件來實現搶紅包算法, Redis是一個在內存中基
執行步驟: 1. 備份 mv -f /etc/apt/sources.list /etc/apt/sources.list.bak 2. 執行替換爲阿里源 cat > /etc/apt/sources.list<< EOF deb
在訪問後端api地址,頁面最下方有列示平臺的各個服務,點擊進入可查看具體的表內容 後端api地址: http://{hostIP}/x_program_center/jest/list.html 其中:{hostIP}爲中
物理結構在很大程度上決定了程序對內存和緩存的使用效率,進而影響算法程序的整體性能。 由於存儲數據的需要長久保存,並且內存的價格比硬盤貴太多,因此內存無法取代硬盤。 緩存的大容量和高速度難以兼得。隨着 L1、L2、L3 緩存的容量逐步增大
背景 百川專項是指物流統一打造企業級能力平臺,戰略上聚焦純配、倉配類業務主線,以提升前臺業務整體交付吞吐率爲核心目標,支撐物流開放領域解決方案和標準產品的快速交付實施。計劃以“百川”專項項目爲契機,加速推動BP團隊將ECLP中各自業務的單
問題描述 分頁返回的記錄總數total和每頁數量pageSize一致,數據庫統計的數量大於當前返回的總記錄數total,以下是相關代碼 問題分析 sql錯誤導致返回信息有誤? 檢查結果:經過數據執行日誌中生成的sql,sql正常並
遇到vue用axios請求後端json對象,發現vue頁面對應的v-for標籤怎麼都不渲染。 首先控制檯打印數據正常,以爲錯誤出現在生命週期鉤子上面。 axios請求在dom渲染之後,但是一頓操作之後還是沒有用。 參考了很多種方法, 第一種
本文分享自華爲雲社區《全網最易用、最實用、最好用的【幻獸帕魯】專用服務器攻略來啦!一鍵部署,5s開服!》,作者: 雲容器大未來。 華爲雲隆重推出“帕魯服務器-雲耀雲容器版”,基於雲耀雲容器助您一鍵快速搭建幻獸帕魯專用服務器,秒級開服,隨時啓
前言 在上一篇文章《還在擔心報表不好做?不用怕,試試這個方法》中,小編分享瞭如何使用模板語言生成報表的過程。今天小編進一步介紹模板語言中一些基本的概念和用法,因此讀者可以配合上一篇文章一起看。 本文介紹的內容有: 模板文件 綁定數據源 單