>  기사  >  백엔드 개발  >  php锛媘ysql鎵庡疄涓汉鍩烘湰鍔焈PHP鏁欑▼ | 甯涔嬪

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

WBOY
WBOY원래의
2016-07-13 17:21:301589검색

涓€. 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>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/532436.htmlTechArticle涓€. 10鍙ヨ瘽 1.涓嶈渚濊禆register_global=ON鐨勭幆澧冿紝浠庝綘鍒氭噦寰楅厤缃畃hp杩愯鐜鐢氳嚦灏氫笉鏄庣櫧register_global鐨凮N/OFF浼氬鑷繁鏈変粈涔堝奖鍝嶇殑閭eぉ璧凤紝灏卞簲...
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.