文章目錄 Coding tips I've been coding in PHP ever since I was 13, over the years I have seenmany different coding styles and standards being used. However most ofthem weren't
function pageFactory($path,$layout){ $factorys = Array ("template/1.html"=>TemplatePage1); return new $factorys[$layout]($path,$layout);}class Page{ public $path = null; public $layout = ""; public $data = Array(); public
目前網路上好多網站的新聞發布系統都採用了動態伺服器技術產生靜態HTML的做法,這樣做的好處是:一是能減輕其伺服器的負擔,二是因為產生了HTML靜態頁面,所以其網站被搜尋引擎搜尋到的機率更大一些。筆者的網站曾經使用PHP這 一動態技術來構建新聞發布系統,其原理也就是應用了PHP產生HTML靜態頁面的技術,相關平台是 Windows XP
Learning PHP5.chm Learning PHP and MySQL Jun.2006.eBook-BBL Beginning Php And Mysql 5 From Novice To Professional Beginning PHP and MySQL, 3rd Edition Mar.2008.pdf Core PHP Programming 3rd Ed Prentice Hall.chm Advanced PHP Programming.chm
策略模式跟原廠模式有個共同點就是擴充性好,原廠模式就不多說了(參考前面的原廠模式),策略模式主要解決的問題是:有多種策略可以選擇,根據不同的情況選擇不同的策略,可以隨意的增加策略,而不用去修改使用原則的中間模組。比如說,工資計算,由於公司裡有各個層次的員工計算工資的公式是不一樣的,那麼財務部會根據不同的員工來選擇不同的計算公式。策略模式就是用來解決這類的問題,下面看看例子: <?phpabstract class SalaryAbs{ public function
被PHP的檔案上傳下了一跳,這是我寫過的實現最簡單的檔案上傳了(俺寫過java\asp\c#)<?php$f=&$HTTP_POST_FILES['file'];$dest_dir='uploads';//設定上傳目錄$dest=$dest_dir.'/'.date("ymd")."_".$f['name']; //設定檔案名稱為日期加上檔案名稱避免重複$r=move_uploaded_file($f['tmp_name'],$dest);?><form a
//運行前,你的電腦需要可以運行php的環境,下面,是我的一些做法 //這個是一個運行時的頁面 //show.html ---名字 -------------------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta