Time of Update: 2017-01-13
OK 現在我們來體驗webservice 代碼如下複製代碼 //server端 serverSoap.php$soap = new SoapServer(null,array('uri'=>"http://192.168.1.179/"));//This uri is your SERVER
Time of Update: 2017-01-13
用PHP實現POP3收取郵件的類(作者:陳俊清 2000年10月18日
Time of Update: 2017-01-13
上傳圖片時,上傳的圖片並沒有全部用到,那麼可以設定上傳時只存到臨時檔案夾裡面,文章發布的時候把真正用到的圖片移動到有用的目錄裡,這樣定期清理無用目錄就可以了。 代碼如下複製代碼 //轉移臨時檔案夾中的圖片 $imgssss =
Time of Update: 2017-01-13
先看個例子1,2,3,4,5假如上面5個是ID了,我要對上一頁排序直接使用order by id desc ,如我當前ID為3那麼出來的是2才對,對下一頁我們要用order by id asc得出的排序應該是,4,好了原理就這麼簡。sql實現方法 代碼如下複製代碼 上一頁$sql ="Select 欄位 from 表名 where id<3 order by id desc limit 1";下一頁$sql ="Select 欄位
Time of Update: 2017-01-13
這個是借力打力,只是抓去朋友網的內容!!!不過相當好用哦!看代碼: 代碼如下複製代碼 <?php$videourl='http://v.youku.com/v_show/id_XMjA5MjQ0OTQ0.html';function get_content($url ,$data){ if(is_array($data)){ $data = http_build_query($data, '', '&');
Time of Update: 2017-01-13
301跳轉 代碼如下複製代碼 header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.abc.com/aaa/'); exit(); 不要漏了header(‘HTTP/1.1 301 Moved Permanently’); 不然返回不了301404錯誤頁面 代碼如下複製代碼
Time of Update: 2017-01-13
使用PHP建立編碼格式為utf-8檔案的方法:第一步:建立一個txt檔案,開啟,檔案->另存新檔xxx.php,並將編碼改為UTF-8,儲存。第二部:在php檔案中加入如下代碼: 代碼如下複製代碼 <?php$filename=rand(100,999).".txt";//定義好要建立的檔案名稱和檔案格式(按需要自己改)$str = "PHP知名網[www.111cn.net]";//待寫入建立檔案中的內容if
Time of Update: 2017-01-13
代碼如下複製代碼 項目用到臨時寫的。待完善/* * 根據使用者提交的(swf/html)地址,擷取優酷,馬鈴薯的swf播放地址 * */ private function _getSwf ($url = '') { if(isset($url) &&
Time of Update: 2017-01-13
checkdate() 函數驗證一個格裡高裡日期。例子 代碼如下複製代碼 <?phpvar_dump(checkdate(12,31,2000));var_dump(checkdate(2,29,2003));var_dump(checkdate(2,29,2004));?>輸出:bool(true)bool(false)bool(true) 正則日期例1/** 代碼如下複製代碼 * 檢查是否為一個合法的時間格式** @param
Time of Update: 2017-01-13
方法一 代碼如下複製代碼 @header("http/1.1 404 not found"); @header("status: 404 not found"); echo 'echo 404'; exit(); 載入一個404錯誤頁面 代碼如下複製代碼 @header("http/1.1 404 not found"); @header("status: 404 not found&
Time of Update: 2017-01-13
1、++i 的用法(以 a=++i ,i=2 為例)先將 i 值加 1 (也就是 i=i+1 ),然後賦給變數 a (也就是 a=i ),則最終 a 值等於 3 , i 值等於 3 。所以 a=++i 相當於 i=i+1 ,a=i2、i++ 的用法(以 a=i++ ,i=2 為例)先將 i 值賦給變數 a (也就是 a=i ),然後 i 值加 1 (也就是 i=i+1 ),則最終 a 值等於 2 ,i 值等於 3 。所以 a=i++ 相當於 a=i , i=i+13、++i 與
Time of Update: 2017-01-13
is_file — Tells whether the filename is a regular file用法 bool is_file ( string $filename ) $file 為必選參數來看一個測試is_file經典執行個體<?php教程var_dump(is_file('a_file.txt')) . " ";var_dump(is_file('/usr/bin/')) . &
Time of Update: 2017-01-13
程式中添加時間的初始化語句:“date_default_timezone_set("asia/shanghai");定義和用法the date_default_timezone_set() function sets the default timezone used by all date/time functions.date_default_timezone_set()函數的作用是:設定用於一個指令碼中所有日期時間函數的預設時區。syntax文法
Time of Update: 2017-01-13
php教程 require/include順序詳解在大型的web項目中, include_path是一個模組化設計的根本中的根本(當然,現在也有很多基於autoload的設計, 這個不影響本文的探討), 但是正是因為include_path, 經常會讓我們遇到一些因為沒有找到正確的檔案而導致的看似”詭異”的問題.也就有了如下的疑問:include_path是怎麼起作用的?如果有多個include_path順序是怎麼樣的?什麼情況下include_path不起作用?今天,
Time of Update: 2017-01-13
php中如何判斷圖片格式,下面給出一種較為簡便的方法:第一種思想方法就是把圖片路徑當作字串來處理,那麼判斷圖片格式的也就是變成了尋找.號的字串 代碼如下複製代碼 $file= "test.jpg";$filetype= strtolower(strrchr($file,"."));$arrtype =
Time of Update: 2017-01-13
很不習慣PHP中的變數範圍,PHP中函數變數和全域是完全隔絕的,也就是無法相互訪問。比如下面這樣:copytext 代碼如下複製代碼 $test = 123; abc(); //這裡什麼都不輸出,因為訪問不到$test變數function abc(){ echo($test);}$test = 123;abc(); //這裡什麼都不輸出,因為訪問不到$test變數function abc(){
Time of Update: 2017-01-13
file_get_contents() 遠程檔案擷取函數,用來擷取遠程頁面內容 preg_match_all()進行全域Regex匹配,匹配多次,用於匹配列表 preg_match ()進行Regex匹配,匹配一次,用於匹配終端 preg_replace ()進行Regex替換,用於過濾終端具體步驟Step 1 擷取單頁列表 和 單篇文章內容在批量採集列表和內容之前,我們先將網站的單頁列表和單篇文章的內容採集作為測試Regex對錯。列表頁採集文章的連結地址:
Time of Update: 2017-01-13
也能直接讀取zip壓縮包內的內容,很方便,這裡主要總結下讀取和解壓的過程。解壓一個包到指定目錄 代碼如下複製代碼 <?php$zip = new ZipArchive;if ($zip->open('test.zip') === TRUE) { $zip->extractTo('/my/destination/dir/'); $zip->close(); echo 'ok';} else { echo '
Time of Update: 2017-01-13
memcache support enabled Active persistent connections 0 Revision $Revision: 1.92 $ Directive Local Value
Time of Update: 2017-01-13
php文章點擊查看代碼,現在我們看到很多的網站都會有文章被瀏覽多少點,點擊多少次,評論多少次,等是吧,下面我們這程式就是根據不同的參數實現文章訪問多少次. function newadd($id,$tag,$p){ if($p=='new'){ if(0== $tag){ mysql_query("update gx_news set new_hit=new_hit+1 where