×ðÁú¿­Ê±¹ÙÍøµÇ¼

thinkphpÔõÑùɨ³ýÌØÊâ×Ö·û

1.ʹÓÃPHPÄÚÖú¯Êý

ÔÚPHPÖÐ £¬ÓÐÐí¶à×Ö·û´®²Ù×÷º¯Êý¿É¹©Ê¹Óà £¬Èçstr_replace¡¢preg_replaceµÈ¡£ÎÒÃÇ¿ÉÒÔʹÓÃËüÃÇÀ´É¨³ýһЩ³£¼ûµÄÌØÊâ×Ö·û¡£ºÃ±È £¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏ´úÂëɨ³ýÓû§ÊäÈëµÄµ¥ÒýºÅºÍË«ÒýºÅ£º

$str = $_POST['input'];
$str = str_replace(array("'", "\""), '', $str);

µÇ¼ºó¸´ÖÆ

ÔÚÒÔÉÏ´úÂëÖÐ £¬ÎÒÃÇÊ×ÏÈ»ñÈ¡ÁËÓû§Ìá½»µÄÊý¾Ý £¬È»ºóʹÓÃstr_replaceº¯Êý½«ÆäÖеĵ¥ÒýºÅºÍË«ÒýºÅÌ滻Ϊ¿Õ×Ö·û´® £¬´Ó¶øɨ³ýÁËÕâЩÌØÊâ×Ö·û¡£

²»¹ý £¬PHPº¯ÊýÓÐÐí¶àÏÞÖÆ £¬ÎÞ·¨º­¸ÇËùÓÐÌØÊâ×Ö·û¡£Òò´Ë £¬ÎÒÃÇ¿ÉÒÔʹÓÃÕýÔò±í´ïʽµÄ·½·¨À´É¨³ýÌØÊâ×Ö·û¡£

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡± £»

2.ʹÓÃÕýÔò±í´ïʽ

ÕýÔò±í´ïʽÊÇÒ»¸öÓÃÓÚÆ¥ÅäÎı¾×Ö·ûµÄ¹¤¾ß¡£Ê¹ÓÃpreg_replaceº¯ÊýºÍÕýÔò±í´ïʽ¿ÉÒÔÔÚPHPÖÐÏû³ýÌØÊâ×Ö·û¡£ÏêϸʵÏÖ´úÂëÈçÏ£º

$str = $_POST['input'];
$str = preg_replace('/[\'\"\\\]/', '', $str);

µÇ¼ºó¸´ÖÆ

ÔÚÒÔÉÏ´úÂëÖÐ £¬ÎÒÃÇʹÓÃpreg_replaceº¯ÊýºÍÕýÔò±í´ïʽ £¬Æ¥ÅäÓû§ÊäÈëÖеĵ¥ÒýºÅ¡¢Ë«ÒýºÅºÍ·´Ð±¸Ü £¬´Ó¶ø½«ÆäÌæ»»³É¿Õ×Ö·û´® £¬Íê³ÉÌØÊâ×Ö·ûµÄɨ³ý¡£

³ýÁËÉÏÊöÒªÁì £¬ÉÐÓÐһЩÆäËûµÄɨ³ýÌØÊâ×Ö·ûµÄÒªÁì £¬ÈçʹÓÃhtmlspecialcharsº¯Êý¶ÔÓû§ÊäÈë¾ÙÐÐתÒåµÈ¡£ÎªÈ·±£³ÌÐòµÄÇå¾²ÐÔ £¬ÎÒÃÇÐèҪƾ֤ÏÖÕæÏàÐÎÑ¡ÔñÊʺϵÄÒªÁì¾ÙÐÐÏÖʵ¿ª·¢¡£

ÒÔÉϾÍÊÇthinkphpÔõÑùɨ³ýÌØÊâ×Ö·ûµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ