Time of Update: 2016-07-25
之學習php的時候不敢往演算法上靠近。就是怕擾亂自己的思想,現在回顧一下也還真的就那一回事。嘿嘿!各位有沒有遇到這樣子的情況呢?哈 #冒泡排序法$arr = array(12,45,89,3,24,55,223,76,22,11,89,2,4,5,28,112,20,434,23,65,65,765,6,8,23,5,33,553,45,423,64,77,84,23);
Time of Update: 2016-07-25
//////////// 張樹林 - 慧佳工作室//// Module Name: woods-bhtml.php// Abstract: 產生靜態HTML處理常式尾底// Version: 2.0// 著作權 1001-1006,慧佳工作室所有著作權保護//The software for free software, allowing use, copy,//modify and distribute the software and files. Any//use of this
Time of Update: 2016-07-25
php設計模式之適配器模式,即Adapter(別名Wrapper)模式:將一個類的介面,轉換成客戶期望的另一個類的介面。適配器可以讓原本介面不相容的類合作無間。php設計模式之適配器模式,即Adapter(別名Wrapper)模式:將一個類的介面,轉換成客戶期望的另一個類的介面。適配器可以讓原本介面不相容的類合作無間。這種設計模式的要點:1)、適配器模式主要應用於“希望複用一些現存的類,但是介面又與複用環境要求不一致的情況”,在遺留代碼複用、類庫遷移等方面非常有用。2)、適配器模式有對象適配器和
Time of Update: 2016-07-25
/** * transform ' hello, world !' to array('hello', 'world') * url: http://bbs.it-home.org* date: 2013/2/17*/ function strsToArray($strs) { $result = array(); $array = array(); $strs = str_replace(',', ',', $strs); $strs = str_replace("n", ',',
Time of Update: 2016-07-25
echo __FILE__ ; // 取得當前檔案的絕對位址,結果:F:\www\test.phpecho dirname(__FILE__); // 取得當前檔案所在的絕對目錄,結果:F:\www\echo dirname(dirname(__FILE__)); //取得當前檔案的上一層目錄名,結果:F:\?>複製代碼這裡順便提一下php中的另一個函數:chdir()函數。chdir() 函數定義和用法chdir() 函數把當前的目錄改變為指定的目錄。若成功,則該函數返回 true,否則返回
Time of Update: 2016-07-25
PHP轉換檔夾下所有檔案的編碼 適合發布網站的其他編碼版本 比如你有一個GBK版本 你想有一個UTF8版本 或者你只有GBK的源碼 你想二次開發 但是你不想改變IDE的編碼方式 你可以用這個程式將其批量轉化為UTF8 /** * 把一個檔案夾裡的檔案全部轉碼 只能轉一次 否則全部變亂碼 * @param string $filename */function iconv_
Time of Update: 2016-07-25
第一次分享,讓大家踩踩 @charset "utf-8";*{padding:0;margin:0;}.page {font-size: 14px;text-align:center}.page ul{list-style-type:none;display:table;margin-left:auto;margin-right:auto}.page ul li{min-
Time of Update: 2016-07-25
/** 建立目錄*/function makedir($mudir){$file = "./$mudir";@mkdir($file,0777);}/**先創子摸板檔案路徑*/function writemod($filemodname) {$fp=fopen("showmod.shtml","r");$str=fread($fp,filesize("showmod.shtml"));fclose($fp);$fp=fopen($filemodname,"w");fwrite($fp,$str)
Time of Update: 2016-07-25
/** 功能:產生靜態頁面 整理:指令碼學堂 bbs.it-home.org 日期:2013-2-16*/class html{var $dir; //dir for the htmls(without/)var $rootdir; //root of html files(without/):htmlvar $name; //html檔案存放路徑var $dirname; //指定的檔案夾名稱var $url; //擷取html檔案資訊的來源網頁地址var $time;
Time of Update: 2016-07-25
// 擷取檔案的當前路徑 + 檔案名稱echo __FILE__;echo '';// 擷取檔案的當前路徑echo dirname(__FILE__);echo '';// 擷取檔案的上一級目錄路徑echo
Time of Update: 2016-07-25
class SingetonBasic {private static $instance;// other vars..private function __construct() {// do construct..}private function __clone() {}public static function getInstance() {if (!(self::$instance instanceof self)) {self::$instance = new
Time of Update: 2016-07-25
本文是php-redis中文文檔的第四部分,有需要的朋友可以參考下。本文是php-redis中文文檔的第四部分,有需要的朋友可以參考下。getRange (方法不存在)返回名稱為key的string中start至end之間的字元$redis->set('key', 'string value');$redis->getRange('key', 0, 5);$redis->getRange('key', -5, -1); setRange
Time of Update: 2016-07-25
/* func: get_client_ip() 擷取用戶端IP地址*/function get_client_ip(){ $ip=false; if(!empty($_SERVER["HTTP_CLIENT_IP"])) { $ip = $_SERVER["HTTP_CLIENT_IP"]; } if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
Time of Update: 2016-07-25
$con = file_get_contents("http://bbs.it-home.org/wzjs/");$pattern="//";$new_con = preg_replace($pattern,"$0",$con);echo $new_con;?> 複製代碼說明:$0表示這個匹配內容,$1表示第一個()匹配的內容
Time of Update: 2016-07-25
注意:ob_flush()和flush()這兩個函數一般要一起使用,順序是先ob_flush(),然後flush(),它們的作用是重新整理緩衝區。這裡具體的說下什麼時候要用到重新整理緩衝區和為什麼要重新整理緩衝區。注意:ob_flush()和flush()這兩個函數一般要一起使用,順序是先ob_flush(),然後flush(),它們的作用是重新整理緩衝區。這裡具體的說下什麼時候要用到重新整理緩衝區和為什麼要重新整理緩衝區。一、什麼時候要重新整理緩衝區當程式中用到file_get_content
Time of Update: 2016-07-25
/*** 自動載入相關類庫檔案*/function __autoload($classname){if(substr($classname,-6)=="Action"){include APP_PATH.'controllers/'.$classname.'.class.php';}elseif(substr($classname, -5)=="Model"){include
Time of Update: 2016-07-25
extension_dir="/usr/local/php/etc/ext"#Load模組extension=ftp.so複製代碼#儲存退出至此,成功完成ftp擴充的載入。 您可能感興趣的文章:php ftp函數應用(範例,ftp類,建立目錄函式等)php自訂ftp類與調用執行個體php ftp類(上傳、下載、複製、移動等)仿CodeIgniter的FTP類的實現代碼php實現ftp上傳的類與調用樣本php ftp檔案上傳函數的簡單例子php
Time of Update: 2016-07-25
本文是php-redis中文文檔的第二部分,接上篇,繼續介紹redis官方提供的一些命令的提示,有需要的朋友可以參考下。本文是php-redis中文文檔的第二部分,接上篇,繼續介紹redis官方提供的一些命令的提示,有需要的朋友可以參考下。mset (redis版本1.1以上才可以用)同時給多個key賦值$redis->mset(array('key0' => 'value0', 'key1' => 'value1')); multi, exec,
Time of Update: 2016-07-25
本文是php-redis中文文檔的第五部分,有需要的朋友可以參考下。本文是php-redis中文文檔的第五部分,有需要的朋友可以參考下。Hash操作hSet$redis->hSet('h', 'key1', 'hello');向名稱為h的hash中添加元素key1—>hello hGet$redis->hGet('h', 'key1');返回名稱為h的hash中key1對應的value(hello) hLen$redis->hLen('h');返回名稱為h的hash中元素個數
Time of Update: 2016-07-25
echo function_exists('addcslashes');//檢測是否存在該函數echo get_magic_quotes_gpc().'';//檢測是否開啟自動轉義echo PHP_VERSION.'';//php版本資訊echo addcslashes("Who's John Adams?");echo '';$str = "Who's John Adams?";echo addslashes($str);?> 複製代碼輸出結果是否一樣呢?105.3.6Warning: