Time of Update: 2016-07-25
本文介紹下,在php程式中,不能使用mb_開頭的函數的解決方案,有需要的朋友,可以參考下。按如下的步驟來解決 在php中不能使用mb_開頭函數的問題。1,確認d:/php/ext/php_mbstring.dlls模組是否存在?不存在時,找個安裝程式,找到php_mbstring.dlls複製到d:/php/ext下(假設php安裝在d:/php目錄下)。2,更改php的設定檔php.ini 增加: 複製代碼
Time of Update: 2016-07-25
/*** php自訂gzdecode解壓縮gzip檔案* edit bbs.it-home.org*/if (!function_exists('gzdecode')) { function gzdecode ($data) { $flags = ord(substr($data, 3, 1)); $headerlen = 10; $extralen = 0; $filenamelen = 0; if ($flags & 4) { $extralen = unpack('v' ,substr($
Time of Update: 2016-07-25
zlib.output_compression = Onzlib.output_compression_level = 6複製代碼完成後可以通過phpinfo()函數檢測結果,當zlib.output_compression的Local
Time of Update: 2016-07-25
本文介紹下,在windows或linux中,配置php定時執行的方法,有需要的朋友,參考下吧。1、在windows下 注意:如果不想無限制啟動並執行話,判斷需要修改。另外,apache重啟或關閉之後不會繼續運行,需要重新運行一次以開始程式。
Time of Update: 2016-07-25
nginx中文手冊下載複製代碼2,檔案get.php,內容如下: /*** php實現檔案下載* edit bbs.it-home.org*/if (!isset(GET["file"]) || !isset(GET["type"])) { print "no file selsect"; exit(); }$file = GET["file"].".".GET["type"]; if (@$fp = fopen($file,'r')){ header ("Content-type:
Time of Update: 2016-07-25
/** 例1,文字檔記錄資料* edit bbs.it-home.org*/$counter=1;if(file_exists("mycounter.txt")){$fp=fopen("mycounter.txt","r");$counter=fgets($fp,9);$counter++;fclose($fp);}$fp=fopen("mycounter.txt","w");fputs($fp,$counter);fclose($fp);echo "您是第".$counter."次訪問本頁面!
Time of Update: 2016-07-25
Header("Location: http://bbs.it-home.org";);exit;//在每個重新導向之後都要加上“exit",避免發生錯誤後,繼續執行。?>複製代碼2, header("refresh:2;url=http://bbs.it-home.org");echo "正在載入,請稍等...三秒後自動跳轉至程式員之家...";?>複製代碼例二:禁止頁面在IE中緩衝使瀏覽者每次都能得到最新的內容,而不是 Proxy 或 cache 中的資料: header(
Time of Update: 2016-07-25
CREATE TABLE `type` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fid` int(11) NOT NULL DEFAULT '0', `name` varchar(50) NOT NULL, PRIMARY KEY (`id`))複製代碼二、添加添加幾個頂級分類 INSERT INTO `type` (`id`, `fid`, `name`) VALUES (NULL, '0', '手機');INSERT INTO `type`
Time of Update: 2016-07-25
//即使Client斷開(如關掉瀏覽器),PHP指令碼也可以繼續執行.ignore_user_abort();// 執行時間為無限制,php預設的執行時間是30秒,通過set_time_limit(0)可以讓程式無限制的執行下去set_time_limit(0);// 每隔5分鐘運行$interval=60*5;do{$url = “http://bbs.it-home.org”;$ch = curl_init();curl_setopt($ch, CURLOPT_URL,
Time of Update: 2016-07-25
/*** 計算時間相差多少天,多少小時* edit bbs.it-home.org*/function DateDiff($startDay,$endDay){ $start=strtotime($startDay); $end=strtotime($endDay); $diff=abs($start-$end); $day=''; $vals=array('天'=>'86400','時'=>'3600','分'=>'60','秒'=>'1');
Time of Update: 2016-07-25
CREATE TABLE ccol(id integer not null auto_increment, #記錄的IDip char(15) not null, #訪問者的IP地址dtstamp datetime not null, #最後訪問時間uri char(255), #訪問者請求的URIprimary key (id));複製代碼然後,編寫統計用的php代碼 /*檔案:ccol.php目的:統計同時線上瀏覽的人數edit: bbs.it-home.org*/$duration=180
Time of Update: 2016-07-25
本文介紹下,php中有關mysql_real_escape_string()函數的用法,有需要的朋友,參考下吧。定義和用法mysql_real_escape_string() 函數轉義 SQL 陳述式中使用的字串中的特殊字元。下列字元受影響:\x00\n\r\'"\x1a如果成功,則該函數返回被轉義的字串。如果失敗,則返回 false。文法mysql_real_escape_string(string,connection)參數 描述string 必需。規定要轉義的字串。connection
Time of Update: 2016-07-25
file_uploads = On ;開啟檔案上傳選項upload_max_filesize = 500M ;上傳檔案上限複製代碼其次,如果要上傳極大的檔案,除了修改以上兩項之外,還必須把伺服器緩衝上限調大,把指令碼最大執行時間變長。如下: post_max_size = 500M ;post上限max_execution_time = 1800 ; Maximum execution time of each script, in seconds指令碼最大執行時間max_input_time
Time of Update: 2016-07-25
/*** php上傳檔案* edit: bbs.it-home.org*/if ((($_FILES["file"]["type"] == "image/gif")|| ($_FILES["file"]["type"] == "image/jpeg")|| ($_FILES["file"]["type"] == "image/pjpeg"))&& ($_FILES["file"]["size"] { if ($_FILES["file"]["error"] > 0) {
Time of Update: 2016-07-25
用Regex匹配數字很方便,這裡介紹下用正則來匹配無重複的5到10位元字的方法,供大家參考。匹配有重複的5到10位元字,Regex可以這樣寫:\d{5,10}。若要匹配無重複的5到10位元字,參考了下網上別人的方法,如下: ^(?!\d*?(\d)\d*?\1)\d{5,10}$ 下面舉一個用在php中的匹配無重複數位例子,如下:';if($result>0) { echo '符合';}else { echo '不符合';}?>
Time of Update: 2016-07-25
本文介紹下,php中有關ob_get_contents()、ob_end_clean()、ob_start()函數的具體用法,有需要的朋友參考下吧。php緩衝相關函數:ob_get_contents();ob_end_clean();ob_start()使用ob_start()把輸出那同輸出到緩衝區,而不是到瀏覽器。然後用ob_get_contents得到緩衝區的資料。ob_start()在伺服器開啟一個緩衝區來儲存所有的輸出。因此,在任何時候使用echo
Time of Update: 2016-07-25
本文介紹下,php產生帶logo的二維碼映像的一例代碼,學習二維碼的朋友,可以做個參考。在php中,產生二維碼圖片,可以藉助QRcode類實現。有關QRcode類的內容,請參考文章:php產生二維碼映像的類QRcode 以下介紹在二維碼QR圖中加LOGO的實現方法,主要分為以下幾個步驟:步驟1,產生QR原圖;步驟2,以加浮水印的方式加上LOGO圖片,即可產生個人化的二維碼。
Time of Update: 2016-07-25
include '../../inc/auth.php';include '../public/Base.php';include '../public/BoonList.php';//以上是pdo串連資料庫的代碼,大家自行完成。header('Cache-Control: no-cache, must-revalidate');header('Content-type: application/vnd.ms-excel');header('Content-Disposition:
Time of Update: 2016-07-25
$array1 = array("A","B","C","D"); $array2 = array("1","2","3","4"); $array3 = array("!","@","#","$"); $arrayX = array_merge($array1, $array2, $array3); //將3個數組合并起來 print_r($arrayX); ?> 複製代碼例2,php數組合并。 $array1 =
Time of Update: 2016-07-25
preg_replace(”/([\x80-\xff])/”,”",$str); preg_replace(”/([u4e00-u9fa5])/”,”",$str);複製代碼例子,php中文編碼判斷。 //判斷內容裡有沒有中文-gbk (php) function check_is_chinese($s){ return preg_match('/[\x80-\xff]./', $s); } //擷取字串長度-gbk (php) function gb_strlen($str){ $count