這個是參照了別人的網站, 有點分層的意識..
下面把代碼粘出來保存.
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> |'); } } } ?>
PS: http://man.linuxde.net/vi /etc/init.d/network restart //=========================================== 更新腳本 cd /www/scr
低級錯誤 文件名和類名 不一致,導致找不到類 這種最好不要複製粘貼,而是用命令生成文件. 複製粘貼太容易出錯了. 數據庫連接端口寫錯了,結果頁面總是超時, 記住:沒開啓報錯, 遇到錯誤先開啓報錯,查日誌 // .html結尾的,或者一些
protected function getNode(){ //$CONTROLLER_NAME = $this->_CI->router->fetch_class(); //$ACTION_NAME = $this->_
本文分享自華爲雲社區《重磅新品發佈!雲耀數據庫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開服!》,作者: 雲容器大未來。 華爲雲隆重推出“帕魯服務器-雲耀雲容器版”,基於雲耀雲容器助您一鍵快速搭建幻獸帕魯專用服務器,秒級開服,隨時啓
前言 在上一篇文章《還在擔心報表不好做?不用怕,試試這個方法》中,小編分享瞭如何使用模板語言生成報表的過程。今天小編進一步介紹模板語言中一些基本的概念和用法,因此讀者可以配合上一篇文章一起看。 本文介紹的內容有: 模板文件 綁定數據源 單