PHPÖеÄereg()Óëeregi()º¯ÊýµÄ²»Í¬
ereg()
×Ö·û´®±È¶Ô½âÎö¡£
Óï·¨: int ereg(string pattern, string string, array [regs]);
·µ»ØÖµ: ÕûÊý/Êý×é
º¯ÊýÖÖÀà: ×ÊÁÏ´¦Àí
ÄÚÈÝ˵Ã÷
±¾º¯ÊýÒÔ pattern µÄ¹æÔòÀ´½âÎö±È¶Ô×Ö·û´® string¡£±È¶Ô½á¹û·µ»ØµÄÖµ·ÅÔÚÊý×é²ÎÊý regs Ö®ÖУ¬regs[0] ÄÚÈݾÍÊÇÔ×Ö·û´® string¡¢regs[1] ΪµÚÒ»¸öºÏºõ¹æÔòµÄ×Ö·û´®¡¢regs[2] ¾ÍÊǵڶþ¸öºÏºõ¹æÔòµÄ×Ö·û´®£¬ÓàÀàÍÆ¡£ÈôÊ¡ÂÔ²ÎÊý regs£¬ÔòÖ»Êǵ¥´¿µØ±È¶Ô£¬ÕÒµ½Ôò·µ»ØֵΪ true¡£
ʹÓ÷¶Àý
¼òµ¥Àý×Ó£º
<?php
if (ereg("c","abcdef")){ //˵Ã÷£ºÅжÏabcdefÖÐÊÇ·ñº¬ÓÐ×Öĸc
echo "ͨ¹ý";
}else{
echo "´íÎó";
}
?>
ÏÂÃæÕâ¸öÀý×ÓÊǶÔÊäÈëµÄ E-Mail ×÷¼òµ¥µÄ¼ì²é£¬¼ì²éʹÓÃÕßµÄ E-Mail ×Ö·û´®ÊÇ·ñÓÐ @ ×Ö·û£¬ÔÚ @ ×Ö·ûÇ°ÓÐÓ¢ÎÄ×Öĸ»òÊý×Ö£¬ÔÚÖ®ºóÓÐÊý½Ú×Ö·û´®£¬×îºóµÄСÊýµãºóÖ»ÄÜÓжþ¸ö»òÈý¸öÓ¢ÎÄ×Öĸ¡£super@mail.wilson.gs ¾Í¿ÉÒÔͨ¹ý¼ì²é£¬super@mail.wilson ¾Í²»ÄÜͨ¹ý¼ì²é¡£
<?php
if (ereg("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$email)) {
echo "ÄúµÄ E-Mail ͨ¹ý³õ²½¼ì²é";
}
?>
eregi()
Ó÷¨Óë ereg() Ïàͬ¡£²»Í¬Ö®´¦ÔÚÓÚ
ÏÂÃæ¾ÙÀý˵Ã÷ÕâÁ½¸öº¯ÊýµÄÇø±ð£º
ÔÚabcdefÖвéÕÒÊÇ·ñº¬Óдóд×ÖĸC
<?php
if (ereg("C","abcdef")){
echo "ͨ¹ý";
}else{
echo "´íÎó";
}
?>
//·µ»Ø½á¹ûÊÇ£º´íÎó
<?php
if (eregi("C","abcdef")){
echo "ͨ¹ý";
}else{
echo "´íÎó";
}
?>
//·µ»Ø½á¹ûÊÇ£ºÍ¨¹ý
ereg() ÓÐÇø·Ö´óСд£¬eregi()±¾º¯ÊýÓë´óСдÎ޹ء£
Ïà¹ØÎĵµ£º
·µ»ØÒ»¸ö½á¹ûÈ«ÊÀ½ç¶¼ÖªµÀÔõô´¦Àí£¬¹Ø¼üÊÇ·µ»Ø¶à¸ö½á¹û¼¯¾Í²»ºÃ°ìÁË£¬ÏÂÃæÓÐÒ»½â¾ö°ì·¨
´æ´¢¹ý³Ì´úÂë
DELIMITER $$;
DROP PROCEDURE IF EXISTS `test`.`sp_test`$$
CREATE PROCEDURE `test`.`sp_test` ()
BEGIN
select * from `user`.`user` limit 0, 50;
select coun ......
µÚÒ»ÖÖ·½·¨£º
<?php
class Access{
function getConn(){
$conn = @new COM("ADODB.Connection") or die ("ADOÁ¬½Óʧ°Ü!");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath(__IMP ......
preg_replace -- Ö´ÐÐÕýÔò±í´ïʽµÄËÑË÷ºÍÌæ»»
array_push -- ½«Ò»¸ö»ò¶à¸öµ¥ÔªÑ¹ÈëÊý×éµÄĩ⣨ÈëÕ»£©
preg_match -- ½øÐÐÕýÔò±í´ïʽƥÅä
exif_imagetype($file) ---ͼÏñÀàÐÍ£»
echo "<SCRIPT LANGUAGE='JavaScript'>alert('µÃµ½');history.back();</SCRIPT>";
exit;
date_defaul ......
PHPÊÇÒ»ÖÖÓÃÓÚ´´½¨¶¯Ì¬WEBÒ³ÃæµÄ·þÎñ¶Ë½Å±¾ÓïÑÔ¡£ÈçͬASPºÍColdFusion£¬Óû§¿ÉÒÔ»ìºÏʹÓÃPHPºÍHTML±àдWEBÒ³Ã棬µ±·ÃÎÊÕßä¯ÀÀµ½¸ÃÒ³Ãæʱ£¬·þÎñ¶Ë»áÊ×ÏȶÔÒ³ÃæÖеÄPHPÃüÁî½øÐд¦Àí£¬È»ºó°Ñ´¦ÀíºóµÄ½á¹ûÁ¬Í¬HTMLÄÚÈÝÒ»Æð´«Ë͵½·ÃÎʶ˵Ää¯ÀÀÆ÷¡£µ«ÊÇÓëASP»òColdFusion²»Í¬£¬PHPÊÇÒ»ÖÖÔ´´úÂ뿪·Å³ÌÐò£¬ÓµÓкܺõĿçƽ̨¼ ......
ÓйرäÁ¿µÄ´«µØÖ·¸³Öµ
PHP 3 ÖУ¬±äÁ¿×ÜÊÇ´«Öµ¸³Öµ¡£PHP 4
ÌṩÁËÁíÍâÒ»ÖÖ·½Ê½¸ø±äÁ¿¸³Öµ£º´«µØÖ·¸³Öµ¡£Ê¹Óô«µØÖ·¸³Öµ£¬¼´¼òµ¥µØ×·¼ÓÒ»¸ö£¨&£©·ûºÅµ½½«Òª¸³ÖµµÄ±äÁ¿Ç°£¨Ô´±äÁ¿£©¡£Öйú×Ôѧ±à³ÌÍø£¬www.zxbc.cn
ÕâÒâζ×ÅеıäÁ¿¼òµ¥µÄÒýÓÃÁËÔʼ±äÁ¿,¸Ä¶¯ÐµıäÁ¿½«Ó°Ïìµ½Ôʼ±äÁ¿£¬·´Ö®ÒàÈ»¡£
<?p ......