涓€. 10鍙ヨ瘽
1.涓嶈渚濊禆register_global=ON鐨勭幆澧冿紝浠庝綘鍒氭噦寰楅厤缃畃hp杩愯鐜鐢氳嚦灏氫笉鏄庣櫧register_global鐨凮N/OFF浼氬鑷繁鏈変粈涔堝奖鍝嶇殑閭eぉ璧凤紝灏卞簲璇ュ媷鏁㈠湴鎶婂畠璁句负OFF.
2.鍐欑▼搴忓墠鐪嬬湅鎬庝箞鐢╡rror_reporting.
3.涓嶆噦灏遍棶鏈韩娌¢敊锛屼絾浣犻渶瑕佸湪閭d箣鍓嶆煡鏌ユ墜鍐屻€?BR>4.褰撶劧锛屼綘闇€瑕佹噦寰椾娇鐢ㄦ墜鍐屻€傛墜鍐屼笂鎵句笉鍒扮瓟妗堢殑鏃跺€欙紝搴旇鑰冭檻涓嬬綉缁滀笂鐨勬悳绱㈠紩鎿庛€?BR>5.鍒氬浼歱hp+mysql涔嬪悗锛屼笉瑕佸彨鍤风潃瑕佸啓璁哄潧锛岃鍐橷XX銆傝鏄庣櫧锛屽垰瀛︿細鍐欐眽瀛楀苟涓嶈〃绀轰綘鏈夎兘鍔涘啓璇椼€?BR>6.鍦ㄥweb缂栫▼鐨勬椂鍊欙紝浣犲簲璇ュ厛鍘昏璇唄tml杩欎釜鏈嬪弸銆?BR>7.鏈夌偣鑳藉姏鍚庯紝璇曠潃鍥炵瓟鏂版墜鐨勯棶棰橈紝涓嶈鐪嬪埌鑷繁鎳傜殑鑰屽埆浜轰笉鎳傚氨娌炬簿鑷枩锛屾墧涓嬩竴鍚嶁€滅畝鍗曪紝閭f槸鍩烘湰鐨勪笢瑗库€濆氨璧版洿瑕佷笉寰椼€?BR>8.鎬濊€冩槸涓€涓ソ涔犳儻锛屼笉鍔ㄦ墜鍘诲啓灏辩瓑浜庣┖鎯筹紝浠€涔堜篃娌℃湁銆?BR>9.鍐欏ソ涓€娈电▼搴忥紝濡傛灉瑙夊緱寰堟弧鎰忥紝涓€鍛ㄥ悗鍐嶇湅涓€閬嶏紝涔熻浣犱細璁や负瀹冨簲璇ユ湁鎵€鏀瑰彉
10.鏈夌┖澶氱湅鐪嬪埆浜虹殑绋嬪簭锛屾壘鍑轰粬浜虹殑涓嶈冻鎴栦紭鐐癸紝鑷繁鎺傞噺銆?BR>
浜? 鍚勫彇鎵€闇€
1.鍠勪簬浣跨敤鈥滃紩鐢ㄢ€?瀹冭兘鐩存帴褰卞搷鍒扮▼搴忕殑鏁堢巼銆?BR>
2.鍠勪簬鐢ㄤ笁鍏冭繍绠楀瓙,鍙互璁╃▼寮忚緝绮剧畝鏈夋晥鐜囥€?BR>姣斿:
PHP浠g爜:<hr> <br>if ($data[$i][nickname]) <br>{ <br> $nickname = $data[$i][nickname]; <br>} <br>else <br>{ <br> $nickname = $data[$i][ip]; <br>}<br> <hr>
鍙互鍐欐垚:
PHP浠g爜:<hr> <br>$nickname = $data[$i][nickname] ? $data[$i][nickname] : $data[$i][ip];<br> <hr>
3.鍠勪簬缁勭粐if...else...鍥炲湀
姣斿:
PHP浠g爜:<hr> <br>$ext_name = strtolower(str_replace(".", "", strrchr($upfilename, "."))); <br>if (!empty($type)) <br>{ <br> if (!strpos($type, $ext_name)) <br> { <br> echo "Please upload the file of $type form."; <br> exit(); <br> } <br>}<br> <hr>
涓婇潰鐨勪唬鐮佷綘搴旇鍐欐垚杩欐牱:
PHP浠g爜:<hr> <br>$ext_name = strtolower(str_replace(".", "", strrchr($upfilename, "."))); <br>if (!($type===) && strpos($type, $ext_name)===false) <br>{ <br> echo "Please upload the file of $type form."; <br> exit(); <br>}<br> <hr>
4.灏介噺璁╀綘鐨勪唬鐮佹竻娣呬簺
濡傛灉鍐欐垚杩欐牱锛屾槸姣旇緝璁╀汉澶寸棝鐨?
PHP浠g爜:<hr> <br>$foo=$_post["foo"]; <br> $username=$_post["user"]; <br>$group=$_POST["group"]; <br>if ($group=="wheel"){ <br>$username=$username."wheel"; <br>}<br> <hr>
鍚屾牱鐨勪唬鐮侊紝杩欐牱灏辨瘮杈冭浜虹湅寰楄垝鏈嶄簡:
PHP浠g爜:<hr> <br>$foo = $_post["foo"]; <br>$username = $_post["username"]; <br>$group = $_POST["group"]; <br>if ($group=="wheel") <br>{ <br> $username = $username."wheel"; <br>}<br> <hr>
褰撶劧锛屾湁涓€瀹氬熀纭€鍚庯紝浣犲簲璇ヨ鍐欐垚杩欐牱:
PHP浠g爜:<hr> <br>$foo = &$_POST[foo]; <br>$username = $_POST["group"]!=wheel ? $_POST["username"] : $_POST["username"].wheel;<br> <hr>
5.缂栧啓瑙勮寖鐨刴ysql 璇彞銆?BR>瀛楁鍜岃〃鍚嶇敤"`"寮曡捣鏉ワ紝閬垮厤淇濈暀瀛楃殑褰卞搷銆?BR>濡傛灉鐪嬪埌涓嬮潰杩欐牱鐨勪竴涓猻ql query锛屼細璁╀汉姣旇緝澶寸棝:
PHP浠g爜:<hr> <br>$query="select `flash_comment`.`content` , `flash_comment`.`nickname` , `flash_comment`.`date` , `flash_comment`.`ip` , `product`.`p_name` , `sgflash`.`fid` from `flash_comment` left join `product` on ( `flash_comment`.`p_no` = `product`.`p_no` ) left join `sgflash` on ( `product`.`p_name` = `sgflash`.`f_name` ) where `flash_comment`.`p_no` != order by `flash_comment`.`date`";<br> <hr>
鍚屾牱鐨勪竴涓猶uery,鍐欐垚杩欐牱灏变护浜虹湅寰楁槑鐧藉緱澶氫簡:
PHP浠g爜:<hr> <br>$query = "SELECT `flash_comment`.`content` , `flash_comment`.`nickname` , `flash_comment`.`date` , `flash_comment`.`ip` , `product`.`p_name` , `sgflash`.`fid` <br> FROM `flash_comment` <br> LEFT JOIN `product` ON ( `flash_comment`.`p_no` = `product`.`p_no` ) <br> LEFT JOIN `sgflash` ON ( `product`.`p_name` = `sgflash`.`f_name` ) <br> WHERE `flash_comment`.`p_no` != <br> ORDER BY `flash_comment`.`date`";<br>