鐢ㄥ崟寮曞彿浠f浛鍙屽紩鍙锋潵鍖呭惈瀛楃涓诧紝杩欐牱鍋氫細鏇村揩涓€浜涖€傚洜涓篜HP浼氬湪鍙屽紩鍙峰寘鍥寸殑瀛楃涓蹭腑鎼滃鍙橀噺锛屽崟寮曞彿鍒欎笉浼氾紝娉ㄦ剰锛氬彧鏈塭cho鑳借繖涔堝仛锛屽畠鏄竴绉嶅彲浠ユ妸澶氫釜瀛楃涓插綋浣滃弬鏁扮殑鈥滃嚱鏁扳€濓紙璇戞敞锛歅HP鎵嬪唽涓echo鏄瑷€缁撴瀯锛屼笉鏄湡姝g殑鍑芥暟锛屾晠鎶婂嚱鏁板姞涓婁簡鍙屽紩鍙凤級銆?br>1銆佸鏋滆兘灏嗙被鐨勬柟娉曞畾涔夋垚static锛屽氨灏介噺瀹氫箟鎴恠tatic锛屽畠鐨勯€熷害浼氭彁鍗囧皢杩?鍊嶃€?br>2銆?row[鈥檌d鈥橾 鐨勯€熷害鏄?row[id]鐨?鍊嶃€?br>3銆乪cho 姣?print 蹇紝骞朵笖浣跨敤echo鐨勫閲嶅弬鏁帮紙璇戞敞锛氭寚鐢ㄩ€楀彿鑰屼笉鏄彞鐐癸級浠f浛瀛楃涓茶繛鎺ワ紝姣斿echo聽$str1,$str2銆?br>4銆佸湪鎵цfor寰幆涔嬪墠纭畾鏈€澶у惊鐜暟锛屼笉瑕佹瘡寰幆涓€娆¢兘璁$畻鏈€澶у€硷紝鏈€濂借繍鐢╢oreach浠f浛銆?br>5銆佹敞閿€閭d簺涓嶇敤鐨勫彉閲忓挨鍏舵槸澶ф暟缁勶紝浠ヤ究閲婃斁鍐呭瓨銆?br>6銆佸敖閲忛伩鍏嶄娇鐢╛_get锛宊_set锛宊_autoload銆?br>7銆乺equire_once()浠d环鏄傝吹銆?br>8銆乮nclude鏂囦欢鏃跺敖閲忎娇鐢ㄧ粷瀵硅矾寰勶紝鍥犱负瀹冮伩鍏嶄簡PHP鍘籭nclude_path閲屾煡鎵炬枃浠剁殑閫熷害锛岃В鏋愭搷浣滅郴缁熻矾寰勬墍闇€鐨勬椂闂翠細鏇村皯銆?br>9銆佸鏋滀綘鎯崇煡閬撹剼鏈紑濮嬫墽琛岋紙璇戞敞锛氬嵆鏈嶅姟鍣ㄧ鏀跺埌瀹㈡埛绔姹傦級鐨勬椂鍒伙紝浣跨敤$_SERVER[鈥楻EQUEST_TIME鈥橾瑕佸ソ浜巘ime()銆?br>10銆佸嚱鏁颁唬鏇挎鍒欒〃杈惧紡瀹屾垚鐩稿悓鍔熻兘銆?br>11銆乻tr_replace鍑芥暟姣攑reg_replace鍑芥暟蹇紝浣唖trtr鍑芥暟鐨勬晥鐜囨槸str_replace鍑芥暟鐨勫洓鍊嶃€?br>12銆佸鏋滀竴涓瓧绗︿覆鏇挎崲鍑芥暟锛屽彲鎺ュ彈鏁扮粍鎴栧瓧绗︿綔涓哄弬鏁帮紝骞朵笖鍙傛暟闀垮害涓嶅お闀匡紝閭d箞鍙互鑰冭檻棰濆鍐欎竴娈垫浛鎹唬鐮侊紝浣垮緱姣忔浼犻€掑弬鏁版槸涓€涓瓧绗︼紝鑰屼笉鏄彧鍐欎竴琛屼唬鐮佹帴鍙楁暟缁勪綔涓烘煡璇㈠拰鏇挎崲鐨勫弬鏁般€?br>13銆佷娇鐢ㄩ€夋嫨鍒嗘敮璇彞锛堣瘧娉細鍗硈witch case锛夊ソ浜庝娇鐢ㄥ涓猧f锛宔lse if璇彞銆?br>14銆佺敤@灞忚斀閿欒娑堟伅鐨勫仛娉曢潪甯镐綆鏁堬紝鏋佸叾浣庢晥銆?br>15銆佹墦寮€apache鐨刴od_deflate妯″潡锛屽彲浠ユ彁楂樼綉椤电殑娴忚閫熷害銆?br>16銆佹暟鎹簱杩炴帴褰撲娇鐢ㄥ畬姣曟椂搴斿叧鎺夛紝涓嶈鐢ㄩ暱杩炴帴銆?br>17銆侀敊璇秷鎭唬浠锋槀璐点€?br>18銆佸湪鏂规硶涓€掑灞€閮ㄥ彉閲忥紝閫熷害鏄渶蹇殑銆傚嚑涔庝笌鍦ㄥ嚱鏁颁腑璋冪敤灞€閮ㄥ彉閲忕殑閫熷害鐩稿綋銆?br>19銆侀€掑涓€涓叏灞€鍙橀噺瑕佹瘮閫掑涓€涓眬閮ㄥ彉閲忔參2鍊嶃€?br>20銆侀€掑涓€涓璞″睘鎬э紙濡傦細$this->prop++锛夎姣旈€掑涓€涓眬閮ㄥ彉閲忔參3鍊嶃€?br>21銆侀€掑涓€涓湭棰勫畾涔夌殑灞€閮ㄥ彉閲忚姣旈€掑涓€涓瀹氫箟鐨勫眬閮ㄥ彉閲忔參9鑷?0鍊嶃€?br>22銆佷粎瀹氫箟涓€涓眬閮ㄥ彉閲忚€屾病鍦ㄥ嚱鏁颁腑璋冪敤瀹冿紝鍚屾牱浼氬噺鎱㈤€熷害锛堝叾绋嬪害鐩稿綋浜庨€掑涓€涓眬閮ㄥ彉閲忥級銆侾HP澶ф浼氭鏌ョ湅鏄惁瀛樺湪鍏ㄥ眬鍙橀噺銆?br>23銆佹柟娉曡皟鐢ㄧ湅鏉ヤ笌绫讳腑瀹氫箟鐨勬柟娉曠殑鏁伴噺鏃犲叧锛屽洜涓烘垜锛堝湪娴嬭瘯鏂规硶涔嬪墠鍜屼箣鍚庨兘锛夋坊鍔犱簡10涓柟娉曪紝浣嗘€ц兘涓婃病鏈夊彉鍖栥€?br>24銆佹淳鐢熺被涓殑鏂规硶杩愯璧锋潵瑕佸揩浜庡湪鍩虹被涓畾涔夌殑鍚屾牱鐨勬柟娉曘€?br>25銆佽皟鐢ㄥ甫鏈変竴涓弬鏁扮殑绌哄嚱鏁帮紝鍏惰姳璐圭殑鏃堕棿鐩稿綋浜庢墽琛?鑷?娆$殑灞€閮ㄥ彉閲忛€掑鎿嶄綔銆傜被浼肩殑鏂规硶璋冪敤鎵€鑺辫垂鐨勬椂闂存帴杩戜簬15娆$殑灞€閮ㄥ彉閲忛€掑鎿嶄綔銆?br>26銆丄pache瑙f瀽涓€涓狿HP鑴氭湰鐨勬椂闂磋姣旇В鏋愪竴涓潤鎬丠TML椤甸潰鎱?鑷?0鍊嶃€傚敖閲忓鐢ㄩ潤鎬丠TML椤甸潰锛屽皯鐢ㄨ剼鏈€?br>27銆侀櫎闈炶剼鏈彲浠ョ紦瀛橈紝鍚﹀垯姣忔璋冪敤鏃堕兘浼氶噸鏂扮紪璇戜竴娆°€傚紩鍏ヤ竴濂桺HP缂撳瓨鏈哄埗閫氬父鍙互鎻愬崌25%鑷?00%鐨勬€ц兘锛屼互鍏嶉櫎缂栬瘧寮€閿€銆?br>28銆佸敖閲忓仛缂撳瓨锛屽彲浣跨敤memcached銆俶emcached鏄竴娆鹃珮鎬ц兘鐨勫唴瀛樺璞$紦瀛樼郴缁燂紝鍙敤鏉ュ姞閫熷姩鎬乄eb搴旂敤绋嬪簭锛屽噺杞绘暟鎹簱璐熻浇銆傚杩愮畻鐮?(OP code)鐨勭紦瀛樺緢鏈夌敤锛屼娇寰楄剼鏈笉蹇呬负姣忎釜璇锋眰鍋氶噸鏂扮紪璇戙€?br>29銆佸綋鎿嶄綔瀛楃涓插苟闇€瑕佹楠屽叾闀垮害鏄惁婊¤冻鏌愮瑕佹眰鏃讹紝浣犳兂褰撶劧鍦颁細浣跨敤strlen()鍑芥暟銆傛鍑芥暟鎵ц璧锋潵鐩稿綋蹇紝鍥犱负瀹冧笉鍋氫换浣曡绠楋紝鍙繑鍥炲湪zval 缁撴瀯锛圕鐨勫唴缃暟鎹粨鏋勶紝鐢ㄤ簬瀛樺偍PHP鍙橀噺锛変腑瀛樺偍鐨勫凡鐭ュ瓧绗︿覆闀垮害銆備絾鏄紝鐢变簬strlen()鏄嚱鏁帮紝澶氬灏戝皯浼氭湁浜涙參锛屽洜涓哄嚱鏁拌皟鐢ㄤ細缁忚繃璇稿姝ラ锛屽瀛楁瘝灏忓啓鍖栵紙璇戞敞锛氭寚鍑芥暟鍚嶅皬鍐欏寲锛孭HP涓嶅尯鍒嗗嚱鏁板悕澶у皬鍐欙級銆佸搱甯屾煡鎵撅紝浼氳窡闅忚璋冪敤鐨勫嚱鏁颁竴璧锋墽琛屻€傚湪鏌愪簺鎯呭喌涓嬶紝浣犲彲浠ヤ娇鐢╥sset() 鎶€宸у姞閫熸墽琛屼綘鐨勪唬鐮併€?br>锛堜妇渚嬪涓嬶級
if (strlen($foo) < 5) { echo 鈥淔oo is too short鈥?$ }
锛堜笌涓嬮潰鐨勬妧宸у仛姣旇緝锛?br>if (!isset($foo{5})) { echo 鈥淔oo is too short鈥?$ }
璋冪敤isset()鎭板阀姣攕trlen()蹇紝鍥犱负涓庡悗鑰呬笉鍚岀殑鏄紝isset()浣滀负涓€绉嶈瑷€缁撴瀯锛屾剰鍛崇潃瀹冪殑鎵ц涓嶉渶瑕佸嚱鏁版煡鎵惧拰瀛楁瘝灏忓啓鍖栥€備篃灏辨槸璇达紝瀹為檯涓婂湪妫€楠屽瓧绗︿覆闀垮害鐨勯《灞備唬鐮佷腑浣犳病鏈夎姳澶寮€閿€銆?br>34銆佸綋鎵ц鍙橀噺$i鐨勯€掑鎴栭€掑噺鏃讹紝$i++浼氭瘮++$i鎱竴浜涖€傝繖绉嶅樊寮傛槸PHP鐗规湁鐨勶紝骞朵笉閫傜敤浜庡叾浠栬瑷€锛屾墍浠ヨ涓嶈淇敼浣犵殑C鎴朖ava浠g爜骞舵寚鏈涘畠浠兘绔嬪嵆鍙樺揩锛屾病鐢ㄧ殑銆?+$i鏇村揩鏄洜涓哄畠鍙渶瑕?鏉℃寚浠?opcodes)锛?i++鍒欓渶瑕?鏉℃寚浠ゃ€傚悗缃€掑瀹為檯涓婁細浜х敓涓€涓复鏃跺彉閲忥紝杩欎釜涓存椂鍙橀噺闅忓悗琚€掑銆傝€屽墠缃€掑鐩存帴鍦ㄥ師鍊间笂閫掑銆傝繖鏄渶浼樺寲澶勭悊鐨勪竴绉嶏紝姝eZend鐨凱HP浼樺寲鍣ㄦ墍浣滅殑閭f牱銆傜墷璁拌繖涓紭鍖栧鐞嗕笉澶变负涓€涓ソ涓绘剰锛屽洜涓哄苟涓嶆槸鎵€鏈夌殑鎸囦护浼樺寲鍣ㄩ兘浼氬仛鍚屾牱鐨勪紭鍖栧鐞嗭紝骞朵笖瀛樺湪澶ч噺娌℃湁瑁呴厤鎸囦护浼樺寲鍣ㄧ殑浜掕仈缃戞湇鍔℃彁渚涘晢锛圛SPs锛夊拰鏈嶅姟鍣ㄣ€?br>35銆佸苟涓嶆槸浜嬪繀闈㈠悜瀵硅薄(OOP)锛岄潰鍚戝璞″線寰€寮€閿€寰堝ぇ锛屾瘡涓柟娉曞拰瀵硅薄璋冪敤閮戒細娑堣€楀緢澶氬唴瀛樸€?br>36銆佸苟闈炶鐢ㄧ被瀹炵幇鎵€鏈夌殑鏁版嵁缁撴瀯锛屾暟缁勪篃寰堟湁鐢ㄣ€?br>37銆佷笉瑕佹妸鏂规硶缁嗗垎寰楄繃澶氾紝浠旂粏鎯虫兂浣犵湡姝f墦绠楅噸鐢ㄧ殑鏄摢浜涗唬鐮侊紵
38銆佸綋浣犻渶瑕佹椂锛屼綘鎬昏兘鎶婁唬鐮佸垎瑙f垚鏂规硶銆?br>39銆佸敖閲忛噰鐢ㄥぇ閲忕殑PHP鍐呯疆鍑芥暟銆?br>40銆佸鏋滃湪浠g爜涓瓨鍦ㄥぇ閲忚€楁椂鐨勫嚱鏁帮紝浣犲彲浠ヨ€冭檻鐢–鎵╁睍鐨勬柟寮忓疄鐜板畠浠€?br>41銆佽瘎浼版楠?profile)浣犵殑浠g爜銆傛楠屽櫒浼氬憡璇変綘锛屼唬鐮佺殑鍝簺閮ㄥ垎娑堣€椾簡澶氬皯鏃堕棿銆俋debug璋冭瘯鍣ㄥ寘鍚簡妫€楠岀▼搴忥紝璇勪及妫€楠屾€讳綋涓婂彲浠ユ樉绀哄嚭浠g爜鐨勭摱棰堛€?br>42銆乵od_zip鍙綔涓篈pache妯″潡锛岀敤鏉ュ嵆鏃跺帇缂╀綘鐨勬暟鎹紝骞跺彲璁╂暟鎹紶杈撻噺闄嶄綆80%銆?br>43銆佸湪鍙互鐢╢ile_get_contents鏇夸唬file銆乫open銆乫eof銆乫gets绛夌郴鍒楁柟娉曠殑鎯呭喌涓嬶紝灏介噺鐢╢ile_get_contents锛屽洜涓轰粬鐨勬晥鐜囬珮寰楀锛佷絾鏄娉ㄦ剰file_get_contents鍦ㄦ墦寮€涓€涓猆RL鏂囦欢鏃跺€欑殑PHP鐗堟湰闂锛?br>44銆佸敖閲忕殑灏戣繘琛屾枃浠舵搷浣滐紝铏界劧PHP鐨勬枃浠舵搷浣滄晥鐜囦篃涓嶄綆鐨勶紱
45銆佷紭鍖朣elect SQL璇彞锛屽湪鍙兘鐨勬儏鍐典笅灏介噺灏戠殑杩涜Insert銆乁pdate鎿嶄綔(鍦╱pdate涓婏紝鎴戣鎭舵壒杩?锛?br>46銆佸敖鍙兘鐨勪娇鐢≒HP鍐呴儴鍑芥暟锛堜絾鏄垜