Time of Update: 2016-07-25
$strarray[1] = "hello"; $strarray[2] = "123456"; $strarray[3] = "123hello"; $strarray[4] = "指令碼學堂"; $strarray[5] = "123程式員之家"; $strarray[6] = "hello程式員之家"; $strarray[7] = "123hello程式員之家"; foreach ($strarray
Time of Update: 2016-07-25
//此檔案用於快速測試UTF8編碼的檔案是不是加了BOM,並可自動移除//By Bob Shen$basedir="."; //修改此行為需要檢測的目錄,點表示目前的目錄$auto=1; //是否自動移除發現的BOM資訊。1為是,0為否。//以下不用改動if ($dh = opendir($basedir)) {while (($file = readdir($dh)) !== false) {if ($file!='.' && $file!='..' && !is_dir($basedir."
Time of Update: 2016-07-25
/*** FILE_NAME : arr.php FILE_PATH : test/* 在多維陣列中根據鍵名快速查詢其父鍵以及父索引值** @copyright Copyright (c) 2006-2010* @author Levi* @package test.arr* @subpackage* @version 2011-04-29* @link bbs.it-home.org*/header("Content-Type: text/html; charset=utf-8");$arr
Time of Update: 2016-07-25
zend framework tutorial,運行例子,報如下的錯誤:The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.zend framework tutorial,運行例子,報如下的錯誤:The server encountered
Time of Update: 2016-07-25
//檢查使用者是否登入function checklogin(){if(emptyempty($_SESSION['user_info'])){ //檢查一下session是不是為空白if(emptyempty($_COOKIE['username']) || emptyempty($_COOKIE['password'])){ //如果session為空白,並且使用者沒有選擇記錄登入狀header(”location:login.php?req_url=”.$_SERVER['REQUEST_
Time of Update: 2016-07-25
/** class: 檔案上傳類* author: ZMM* date: 2011.1.20* email: 304924248@qq.com* link: http://bbs.it-home.org*/class Upload {public $up_ext=array(), $up_max=5210, $up_dir;private $up_name, $up_rename=true, $up_num=0, $up_files=array(),
Time of Update: 2016-07-25
/*** @ 擷取子欄目ID號 @ bbs.it-home.org @ 2013/2/26*/private function sonCategoryIds($categoryID){ //@初始化欄目數組 $array[] = $categoryID; do { $ids = ''; $temp = $this->mysql->select('SELECT `id` FROM `pcb_article_category` WHERE
Time of Update: 2016-07-25
/** bbs.it-home.org */$array = array('1' => 'one', '2' => 'two', '3' => 'three'); $arrayobject = new ArrayObject($array);
Time of Update: 2016-07-25
/** des 加密 解密*/class STD3Des{private $key = "";private $iv = "";/*** 構造,傳遞二個已經進行base64_encode的KEY與IV** @param string $key* @param string $iv*/function __construct ($key, $iv){if (empty($key) || empty($iv)) {echo 'key and iv is not
Time of Update: 2016-07-25
寫了一個產生指定長度密碼的函數,有需要的朋友,可以參考下。參數$strength用於確定選擇產生什麼格式的密碼,包括小寫字母組成的字串,大寫字母組成的字串,或純數字...用php寫了一個產生指定長度密碼的函數。參數$strength用於確定選擇產生什麼格式的密碼,包括小寫字母組成的字串,大寫字母組成的字串,或純數字,或以上三種與特殊字元的組合。 調用樣本:
Time of Update: 2016-07-25
$str='指令碼學堂:http://bbs.it-home.org';echo mb_substr($str,0,4,'utf-8');//截取頭5個字,假定此代碼所在php檔案的編碼為utf-8?> 複製代碼 輸出:程式員之家2、擷取中文長度:mb_strlen()mb_strlen( $str, $encoding )$str,要計算長度的字串$encoding,網頁編碼,如utf-8,GB2312,GBK例2:
Time of Update: 2016-07-25
index.html複製代碼2、verifycode.php /* 圖片驗證碼 Powered By KASON test http://bbs.it-home.org */ session_start(); $num=4;//驗證碼個數 $width=80;//驗證碼寬度 $height=20;//驗證碼高度 $code=' '; for($i=0;$i { switch(rand(0,2)) { case 0:$code[$i]=chr(rand(48,5
Time of Update: 2016-07-25
final class UserLogin { public function __construct() { } public static function getUserInfo() { if (isset($_COOKIE["user_id"])&&$_COOKIE["user_id"]&&(trim($_COOKIE["user_id"])!="")) { if
Time of Update: 2016-07-25
/** 人民幣金額數字轉中文大寫 link:bbs.it-home.org date:2013-2-28*/function cny($ns) {static
Time of Update: 2016-07-25
CSV檔案 Comma Separator Value(逗號分隔值)。常用來資料轉換的中間檔案存在,比如:從Mysql中匯出資料到CSV,匯入CSV到SqlServer中。CSV檔案Comma Separator Value(逗號分隔值)。常用來資料轉換的中間檔案存在,比如:從Mysql中匯出資料到CSV,匯入CSV到SqlServer中。linux環境下php從mysql資料庫中將表的資料按照條件匯出成csv,使用utf-8編碼匯出CSV檔案,開啟後中文成了亂碼
Time of Update: 2016-07-25
/* @名稱:PHP加密/解密 @link:bbs.it-home.org @date:2013/2/28 */ function phpencode($code) { $code = str_replace(array('',' $encode = base64_encode(gzdeflate($code)); // 開始編碼 $encode = '"; return $encode;
Time of Update: 2016-07-25
$(".login").live('click',function(){ var username=$(".input_user").val(); var password=$(".input_ps").val(); var code=$('.input_checkcode').val(); if(username==""){ alert("使用者名稱不可為空");
Time of Update: 2016-07-25
//判斷瀏覽器類型echo $_SERVER["HTTP_USER_AGENT"]; //判斷瀏覽器語言echo $_SERVER["HTTP_ACCEPT_LANGUAGE"]; ?>複製代碼下面是兩個完整的樣本,分別判斷瀏覽器類型、瀏覽器語言。1、判斷瀏覽器類型 if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 8.0"))echo "Internet Explorer 8.0";else
Time of Update: 2016-07-25
for($i = 0; $i $_md_color = imagecolorallocate($_img,mt_rand(0, 255),mt_rand(0, 255), mt_rand(0, 255)); imageline($_img, mt_rand(0, 75), mt_rand(0, 75), mt_rand(0, 75), mt_rand(0, 75),$_md_color); }//隨機雪花for($i = 0; $i $_md_color =
Time of Update: 2016-07-25
/** @todo 中文截取,支援gb2312,gbk,utf-8,big5* @http://bbs.it-home.org* @param string $str 要截取的字串* @param int $start 截取起始位置* @param int $length 截取長度* @param string $charset utf-8|gb2312|gbk|big5 編碼* @param $suffix 是否加尾綴*/function csubstr($str, $start=0,