Time of Update: 2016-07-25
/** * Validator for Login. */final class LoginValidator { private function __construct() { } /** * Validate the given username and password. * @param $username and $password to be validated * @return array array of
Time of Update: 2016-07-25
PHP架構的第一個版本,希望使用此架構的人可以提供寶貴的意見。以及相關的BUG。我會在以後的版本中不斷完善。 架構的檔案中擁有大量的注釋資訊,在使用時可以提供參考。 此版本架構中包含了smarty模版工具、fckeditor編輯器、flash批量上傳檔案、jquery相關外掛程式等工具,同時架構中還整理包含了一套後台系統模版,便於php開發人員使用。 架構的具體使用手冊將在個人的部落格中發布 :http://blog.sina.com.cn/u/1971905881。 下載地址:
Time of Update: 2016-07-25
function get_http_response_code($theURL) { $headers = get_headers($theURL); return substr($headers[0], 9, 3); }?> 複製代碼get_headers的作用就是訪問一個遠程地址,把伺服器發送的HTTP頭以數組形式返回。而$header[0]則是伺服器返回的狀態代碼(如果不出意外的話狀態代碼應該都是第一個返回的)。排除重新導向的例子: /** * Fetches
Time of Update: 2016-07-25
private static $_instance; 複製代碼2)、建構函式和複製函數必須聲明為私人的,防止外部程式new類從而失去單例模式的意義: private function __construct() { $this->_db = pg_connect('xxxx'); } private function __clone() { }//覆蓋__clone()方法,禁止複製 複製代碼(3).
Time of Update: 2016-07-25
根據星期擷取月份日期 /** * 根據星期擷取月份日期 * @param int $weenNum 星期0-6 * @return array $days 返回日期數組 */public function
Time of Update: 2016-07-25
/*** 建立bmp格式圖片** @author: legend* @description: create Bitmap-File with GD library* @version: 0.1** @param resource $im 映像資源* @param string $filename 如果要另存新檔檔案,請指定檔案名稱,為空白則直接在瀏覽器輸出* @param integer $bit 映像品質(1、4、8、16、24、32位)* @param integer
Time of Update: 2016-07-25
//未考慮浮點型/* * method 1 * echo number_format($str,2,'.',','); */ /* method2 * 先反轉字串strrev 再str_split($str,3); $str = strrev($str); $arr = str_split($str,3);//987 $res = ''; $count = count($arr);
Time of Update: 2016-07-25
//----------------------------------------------------//函數名:csubstr//作 用:截字串,漢字一個算兩個字元,英文算一個字元//針對GBK(GB2312)編碼的網站//參 數:$str ----原字串// $start ----開始長度// $len ----截取長度//傳回值:截取後的字串//整理人:itlearner//-------------------------------------
Time of Update: 2016-07-25
$C = new Collection();$C->url = 'http://bbs.it-home.org/subject_search?cat=1001&search_text=%E5%B9%B4%E8%BD%BB%E4%BA%BA';$C->startFlag = '';$C->endFlag = '';$C->init();$C->regExp =
Time of Update: 2016-07-25
class MY_Controller extends CI_Controller{ public function __construct() { parent::__construct(); /*判斷是否登入,判斷當前URL是否是auth/login*/ if ( ! $this->tank_auth->is_logged_in() && ( $this->router->fetch_class() != '
Time of Update: 2016-07-25
session_start();$image = imagecreatetruecolor(58,22);$color_Background = imagecolorallocate($image,255,255,255);imagefill($image,0,0,$color_Background);$key = array(‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′,‘a’,'b’,'c’,'d’,'e’,'f’,'g’,'h’,'i’,'j’,'k’,'
Time of Update: 2016-07-25
function daddslashes($string, $force = 0) { if(!$GLOBALS['magic_quotes_gpc'] || $force) { if(is_array($string)) { foreach($string as $key => $val) { $string[$key] = daddslashes($val, $force); } } else { $string =
Time of Update: 2016-07-25
//論壇api登入介面地址 $uri = "http//www.wap.com/ssdfasdfsf" //參數數組 $data = array( 'username' => 'username', 'password' => 'password', ); //操作執行 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $uri);
Time of Update: 2016-07-25
/*二級目錄按ID返回一個二級目錄,用於將內容平均分布在36*36個目錄中。36個目錄為a-z0-9*/function IDcat($id){$p0 = $id % 1296;$p1 = ceil($p0 / 36)-1;$p2 = ($p0-1) % 36 ;return IDnum($p1).’/’.IDnum($p2).’/';}function IDnum($i){if($iif($i==-1){return ‘z’;}else{return $i;}}else{return chr(
Time of Update: 2016-07-25
貨幣數字轉換為中文大寫的php代碼 :<p><?php/** 元後面才加整,有角的就不加整字。*/function num2rmb ($num){$c1=”零壹貳三肆伍陸柒捌玖”;$c2=”分角元拾佰仟萬拾佰仟億”;</p><p>$num=round($num,2);$num=$num*100;if(strlen($num)>10){return “oh,sorry,the number is too
Time of Update: 2016-07-25
php擷取各城市72小時天氣預報內容 擷取各城市天氣預報內容data.txt下載:http://3.ibtf.sinaapp.com/data.txt[注意網頁編碼] 示範地址: http://3.ibtf.sinaapp.com/?city=%E7%9F%B3%E5%AE%B6%E5%BA%84 function
Time of Update: 2016-07-25
$result = $this->result_row($query); 這裡的 $this->result_row() 方法是我自己瞎寫的, 懶得寫執行QUERY和檢測結果數量方法, 不懂怎麼寫的留言或直接看PHP的 mysql教程 www.w3school.com.cn 一個很好的網站....^_^ :::使用方法::: $user = $_POST['user']; if(CheckVal('member','user',$user)){ echo
Time of Update: 2016-07-25
class Pagination 獨立分頁類 調用方式: $pagenation = new Pagination( 4, 10, 200 ); // 4(第一個參數) = currentPage, 10(第二個參數) = pageSize, 200(第三個參數) = 總數 $pagenation->set_link( 'http://www.360hqb.com' ); $pagenation->show();
Time of Update: 2016-07-25
新浪PHP架構純淨版1.1(帶漂亮的瀑布流模板) 示範地址 模板中調用的是 56網開放平台 的視頻資料。。 1、包括無廣告的站外播放器; if( !$trip = $mm->get($key_trip)){ $trip = $this->con->hotVideo(27);
Time of Update: 2016-07-25
只要把該php放進UCenter目錄下,執行就可以了.來源: http://www.tongqiong.com/read.php?tid-27-ds-1.html //作者:www.tongqiong.com//header("content-type:text/html;