php锛媘ysql鎵庡疄涓汉鍩烘湰鍔焈php鏁欑▼|甯涔嬪

涓€. 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爜:
if ($data[$i][nickname])
{
$nickname = $data[$i][nickname];
}
else
{
$nickname = $data[$i][ip];
}

鍙互鍐欐垚:

php浠g爜:
$nickname = $data[$i][nickname] ? $data[$i][nickname] : $data[$i][ip];

3.鍠勪簬缁勭粐if…else…鍥炲湀姣斿:

php浠g爜:
$ext_name = strtolower(str_replace(“.”, “”, strrchr($upfilename, “.”)));
if (!empty($type))
{
if (!strpos($type, $ext_name))
{
echo “please upload the file of $type form.”;
exit();
}
}

涓婇潰鐨勪唬鐮佷綘搴旇鍐欐垚杩欐牱:

php浠g爜:
$ext_name = strtolower(str_replace(“.”, “”, strrchr($upfilename, “.”)));
if (!($type===) && strpos($type, $ext_name)===false)
{
echo “please upload the file of $type form.”;
exit();
}

4.灏介噺璁╀綘鐨勪唬鐮佹竻娣呬簺濡傛灉鍐欐垚杩欐牱锛屾槸姣旇緝璁╀汉澶寸棝鐨?

php浠g爜:
$foo=$_post[“foo”];
$username=$_post[“user”];
$group=$_post[“group”];
if ($group==”wheel”){
$username=$username.”wheel”;
}

鍚屾牱鐨勪唬鐮侊紝杩欐牱灏辨瘮杈冭浜虹湅寰楄垝鏈嶄簡:

php浠g爜:
$foo = $_post[“foo”];
$username = $_post[“username”];
$group = $_post[“group”];
if ($group==”wheel”)
{
$username = $username.”wheel”;
}

褰撶劧锛屾湁涓€瀹氬熀纭€鍚庯紝浣犲簲璇ヨ鍐欐垚杩欐牱:

php浠g爜:
$foo = &$_post[foo];
$username = $_post[“group”]!=wheel ? $_post[“username”] : $_post[“username”].wheel;

5.缂栧啓瑙勮寖鐨刴ysql 璇彞銆?br>瀛楁鍜岃〃鍚嶇敤”`”寮曡捣鏉ワ紝閬垮厤淇濈暀瀛楃殑褰卞搷銆?br>濡傛灉鐪嬪埌涓嬮潰杩欐牱鐨勪竴涓猻ql query锛屼細璁╀汉姣旇緝澶寸棝:

php浠g爜:
$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`”;

鍚屾牱鐨勪竴涓猶uery,鍐欐垚杩欐牱灏变护浜虹湅寰楁槑鐧藉緱澶氫簡:

php浠g爜:
$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`”;

http://www.bkjia.com/phpjc/532436.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/532436.htmltecharticle涓€. 10鍙ヨ瘽 1.涓嶈渚濊禆register_global=on鐨勭幆澧冿紝浠庝綘鍒氭噦寰楅厤缃畃hp杩愯鐜鐢氳嚦灏氫笉鏄庣櫧register_global鐨凮n/off浼氬鑷繁鏈変粈涔堝奖鍝嶇殑閭eぉ璧凤紝灏卞簲…

Posted in 未分类