Time of Update: 2017-01-13
定義和用法 該mysql_field_flags ( )函數返回的旗幟外地的記錄。這一功能得到外地資料mysql_query ( )函數,並返回一個字串的成功,或FALSE或失敗時,有沒有更多的行。可能傳回值:auto_intcrement -1 ,如果設定A UTO_INCREMENT 二進位-1 ,如果外地有比納爾屬性集 斑點-1 ,如果是外地的B LOB 枚舉-1 ,如果外地是一個枚舉領域 multiple_key -1 ,如果外地是一個非唯一關鍵 not_null -1
Time of Update: 2017-01-13
注意:__autoload() 內的錯誤不能被 try-catch 捕獲。 代碼如下複製代碼 function __autoload($class_name){ require_once(PATH.'/calsses/'.$class_name.'.php');}$obj1 = new mycalss1(); 註冊 __autoload() 自動調用的函數:spl 程式碼程式庫在 PHP5.0
Time of Update: 2017-01-13
執行個體 代碼如下複製代碼 <?php/** * 通過圖片的遠程url,下載到本地 * @param: $url為圖片遠程連結 * @param: $filename為下載圖片後儲存的檔案名稱 */function GrabImage($url,$filename) { if($url==""):return false;endif; ob_start();
Time of Update: 2017-01-13
1. 判斷Email: 代碼如下複製代碼 <?phpfunction is_email($email){return strlen($email) > 6 && preg_match("/^[w-.]+@[w-]+(.w+)+$/", $email);}?> 2. 判斷Url: 代碼如下複製代碼 function is_url($str){ return preg_match("
Time of Update: 2017-01-13
php header()頁面跳轉我把blog從http://www.你的網域名稱/blog遷移到http://www.111cn.net網域名稱下,當使用者訪問以前blog地址時,自動跳轉到當前blog的對應文章 代碼如下複製代碼 $url_this=strtolower('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
Time of Update: 2017-01-13
1.擷取一個數組中重複的元素。代碼如下:a.方法一: 代碼如下複製代碼 function array_repeat($arr) { if(!is_array($arr)) return $arr; $arr1 = array_count_values($arr); $newArr = array();
Time of Update: 2017-01-13
在直接在ie瀏覽器中開啟下面地址http://ip.taobao.com/service/getIpInfo.php?ip=8.8.8.8返回資訊 代碼如下複製代碼
Time of Update: 2017-01-13
array_slice() 第一個參數是要切割的數組,第二個參數是起始位置,第三個參數是長度。就是 切割 $arr這個數組,從第0個元素往後數3個。 代碼如下複製代碼 array("a","b","c","d","e","f","g")$arr = array_slice($arr, 0, 3); array_flip實現去重效果
Time of Update: 2017-01-13
先來看個最簡單的下面是php實現的代碼, xxx.mp3就是你的音樂檔案的實際地址, 對外傳播的時候只傳播php地址,mp3地址對外不公開 代碼如下複製代碼 <?php if(strpos($_SERVER['HTTP_REFERER'], 'qq.com') !== FALSE) { header('HTTP/1.1 404 Not Found');
Time of Update: 2017-01-13
下載解壓後為檔案夾減肥:刪除/FCKeditor/目錄下除fckconfig.js, fckeditor.js, fckstyles.xml, fcktemplates.xml,fckeditor.php五個檔案以外的所有檔案刪除目錄/editor/_source,_testcases(基本上,所有_開頭的檔案夾或檔案都是可選的),刪除/editor/filemanager/browser/default/connectors/下除PHP目錄的所有目錄刪除/editor/filemanager/
Time of Update: 2017-01-13
jquery檔案我這裡不提供下載了,大家可以直接到google去下載哦,可以在頁面定義一個調用方法,如下: 代碼如下複製代碼 function getData(){ $.getJSON("http://123.123.123.123/?callback=?", { "m":"data",// 指定php的檔案名稱字 "act":"getdata",// 指定php檔案中的方法
Time of Update: 2017-01-13
代碼如下複製代碼 function getBaiduHotKeyWord(){ $templateRss = file_get_contents('http://top.baidu.com/rss_xml.php?p=top10'); If (preg_match('/<table>(.*)</table>/is', $templateRss, $_description))
Time of Update: 2017-01-13
遍曆某檔案夾下的所有檔案和檔案夾,並且把所以匹配的檔案複製到同一目錄。下面例子把”/www/pooy/baike”目錄裡面的,所有html檔案都複製到”/www/pooy/bk”這個目錄下面。 代碼如下複製代碼 $dir="/www/pooy/baike"; static $dir_list =0; static $file_list =0; function
Time of Update: 2017-01-13
代碼如下複製代碼
Time of Update: 2017-01-13
刪除指定檔案夾所有檔案 代碼如下複製代碼 $cacheDir = '../cache/runtime';$dh = opendir($cacheDir);while ( $file = readdir($dh) ) {if (($file == '.') || ($file == '..')) { continue; }if (file_exists( $cacheDir . '/' .$file)) {if (!unlink($cacheDir . '/' . $file)
Time of Update: 2017-01-13
先來看看效果代碼如下 代碼如下複製代碼 <?php $domain = "www.111cn.net"; /*欲查詢的網域名稱*/ $site_url = 'http://www.baidu.com/s?wd=site%3A'; $all = $site_url.$domain;
Time of Update: 2017-01-13
header實現302臨時重新導向 代碼如下複製代碼 Header("HTTP/1.1 302 Found");Header("Location: http://www.111cn.net"); header實現404無法找到頁面 代碼如下複製代碼 Header("HTTP/1.1 404 Not Found"); 一下函數可實現各種狀態的跳轉: 代碼如下複製代碼 /***
Time of Update: 2017-01-13
前言: PHP中對各類資料庫的操作有著支援,對檔案的操作也同樣有著很豐富的操作方法,很多朋友現在的操作還是基於檔案操作可是有的時候在操作檔案的時候還存在不少的困惑和疑點,以下是我在日常編寫過程中碰到的以及壇上朋友所碰到的關於檔案操作的一些問題收藏吧。 問:如何建立一個檔案? 答: 1、使用fopen("要建立的檔案名稱","參數"),參數可選w,w ,a,a 2、使用exec("echo '' > 要建立的檔案名稱")
Time of Update: 2017-01-13
直接上代碼: 代碼如下複製代碼 <?php$my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse");extract($my_array);echo "$a = $a; $b = $b; $c = $c";?> 猜猜會會出現什麼結果?輸出: &
Time of Update: 2017-01-13
安裝Nginx的方式有很多種,這裡我們還是編譯源碼進行安裝,使用下列命令:$ wget http://nginx.org/download/nginx-1.6.2.tar.gz$ tar -zxvf nginx-1.6.2.tar.gz$ cd nginx-1.6.2$ ./configure --prefix=/usr/local/nginx$ make$ sudo make install如果安裝過程中出現如下錯誤./configure: error: the HTTP rewrite