Time of Update: 2016-07-25
/*** desc:create directory through FTP connection* link:bbs.it-home.org* date:2013/02/24*/function FtpMkdir($path, $newDir) { $server='ftp.yourserver.com'; // ftp server $connection = ftp_connect($server); // connection // login to ftp
Time of Update: 2016-07-25
/** desc:正則過濾html標籤、空格、分行符號等 link:bbs.it-home.org date:2013/2/23*/$str=preg_replace("/\s+/", " ", $str); //過濾多餘斷行符號$str=preg_replace("/$str=preg_replace("//si","",$str); //注釋$str=preg_replace("//si","",$str); //過濾DOCTYPE$str=preg_replace("//si",""
Time of Update: 2016-07-25
/** desc:header函數設定各種HTTP頭 link:bbs.it-home.org date:2013/2/24*///定義編碼 header( 'Content-Type:text/html;charset=utf-8 '); //Atom header('Content-type: application/atom+xml'); //CSS header('Content-type: text/css'); //Javascript header(
Time of Update: 2016-07-25
/** * desc:FTP類* link:bbs.it-home.org* date:2013/02/24 */ class ftp { public $off; // 返回操作狀態(成功/失敗) public $conn_id; // FTP串連 /** * 方法:FTP串連 * @FTP_HOST -- FTP主機 * @FTP_PORT -- 連接埠 * @FTP_USER -- 使用者名稱 * @FTP_PASS -- 密碼 */ function
Time of Update: 2016-07-25
function array_multi2single($array){ static $result_array=array(); foreach($array as $value) { if(is_array($value)) { array_multi2single($value); } else $result_array[]=$value; }
Time of Update: 2016-07-25
開發架構是用來協助開發人員快速設計和開發**站的基礎,幾乎每個月都會有大量的架構被開發人員發布,用來協助web開發人員更簡單和高效的開發web應用。 在這篇文章中,我將總結薈萃出最佳的PHP,HTML5和CSS架構,希望能夠在大家選擇架構的時候能夠供大家參考借鑒。如果你有任何建議和補充,謝謝閱讀! PHP架構 1. Cake
Time of Update: 2016-07-25
/** desc:資料庫類調用執行個體 假設你的資料類是 db_class.php link:bbs.it-home.org date:2013/2/24*/require_once("db_class.php");//1.建立類,並串連資料庫$db = new mssql("dns=aaa;uid=sa;pwd=sa;dbname=test");//2.串連資料庫$conn =
Time of Update: 2016-07-25
/*** @method 多維陣列轉字串* @staticvar array $result_array* @param type $array* @return type* @link bbs.it-home.org*/function arrayToString($arr){if (is_array($arr)){return implode(',', array_map('arrayToString', $arr));}return $arr;}/*** @method
Time of Update: 2016-07-25
我想學php,有沒有推薦的php的入門書籍?我想學android,對java掌握到什麼程度才能開始呢?我c/c++還沒入門,能直接學python嗎?這些問題都是初學者常常縈繞心頭的疑慮。在我們自己的現狀和想要達成的目標間,總是橫亙著一條名為「先決條件」的大河,似乎除了花費巨大的精力遊過這條大河外,別無他法。很不幸,大部分人還沒能夠接近目標,便被湍急的水流沖走了。然而,還是有少部分人似乎坐上了阿拉丁的魔毯,毫無遲滯地直達彼岸,好像學什麼技術都不那麼費勁。這是怎麼回事?學一門新的語言,或者新的技術,
Time of Update: 2016-07-25
header('Content-type: application/image/pjpeg');//輸出的類型 header('Content-Disposition: attachment; filename="downloaded.jpg"'); //下載顯示的名字,注意格式 readfile('my.jpg'); // 並將這個檔案以前面header發送資訊設定的類型輸出,從而會彈出一個下載框 //
Time of Update: 2016-07-25
網站的運行安全肯定是每個站長必須考慮的問題,大家知道,大多數駭客攻擊網站都是採用sql注入,這就是我們常說的為什麼 ?
Time of Update: 2016-07-25
/** desc:遞迴替換數組內容 link:bbs.it-home.org date:2013/2/22*/function arrContentReplact($array){ if(is_array($array)) { foreach($array as $k => $v) { $array[$k] = arrContentReplact($array[$k]); } }else { $
Time of Update: 2016-07-25
/** ftp上傳檔案 link:bbs.it-home.org date:2013/2/25*/$ftp_server = "192.168.8.8";$ftp_user = "test123";$ftp_pass = "yourpassword";// set up a connection or die$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");$login_result
Time of Update: 2016-07-25
寫過PHP+MySQL的程式員都知道有時間差,UNIX時間戳記和格式化日期是我們常打交道的兩個時間表示形式,Unix時間戳記儲存、處理方便,但是不直觀,格式化日期直觀,但是處理起來不如Unix時間戳記那麼自如,所以有的時候需要互相轉換,下面給出互相轉換的幾種轉換方式。 一、在MySQL中完成 這種方式在MySQL查詢語句中轉換,優點是不佔用PHP解析器的解析時間,速度快,缺點是只能用在資料庫查詢中,有局限性。 1. UNIX時間戳記轉換為日期用函數:
Time of Update: 2016-07-25
php二維數組應用舉例-根據條件取資料,假如數組$point_arr(如下),請取出 user_id = 3的那一行數組。php二維數組應用舉例-根據條件取資料,假如數組$point_arr(如下),請取出 user_id = 3的那一行數組。1,"id"=>1,"point"=>2), array("id"=>2,"id"=>3,"point"=>2), array("id"=>3,"id"=>3,"point"=>2), array("id"=>4,"id"=>3,"point"
Time of Update: 2016-07-25
//迭代演算法function md5_1_1($data, $times = 32){//迴圈使用MD5for ($i = 0; $i $data = md5($data);}return $data;}//遞迴演算法function md5_1_2($data, $times = 32){if ($times > 0) {$data = md5($data);$times--;return md5_1_2($data, $times); //實現遞迴} else {return $data;
Time of Update: 2016-07-25
/** desc:遞迴刪除目錄下的檔案 link:bbs.it-home.org date:2013/2/24*/class cacheClearFile{ var $dir = '111cn.Net'; function __construct() { $this->listFils(); } function listFiles() { if(is_dir($this->dir)) { if($dir_file=opendir($this->dir)) {
Time of Update: 2016-07-25
class Counter{ private static $count = 0;//定義一個靜態屬性 const VERSION = 2.0;//定義一個常量 //建構函式 function __construct(){ self::$count++; } //解構函式 function __destruct(){ self::$count--; } //定義一個靜態方法 static function getCount(){ return self::$count;
Time of Update: 2016-07-25
/** desc:判斷上傳檔案類型 link:bbs.it-home.org date:2013/2/24*/$array = array('jpg','gif','png','jpeg');$picImg ='/upfile/upload_pic/thumbnail_1258615556.jpg';$img = strtolower($picImg);//擷取檔案件副檔名方法一$ext =
Time of Update: 2016-07-25
$array1 = array("a" => "green", "red", "blue");$array2 = array("b" => "green", "yellow", "red");$result = array_intersect($array1, $array2);?>複製代碼上例將輸出:Array([a] => green[0] => red)2.array_intersect_assoc()在前一個函數的基礎上,返回所有數組中鍵、值均相同的索引值對。例子: $array1 =