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()±¾º¯ÊýÓë´óСдÎ޹ء£
Àý×Ó
<?php
$str="a";
if(eregi("[0-9]+",$str)){
echo"ÕâÊÇÒ»¸öÊý×Ö";
}
else if(eregi("[a-z]+",$str)){
echo"ÕâÊÇÒ»¸ö×Öĸ";
}
else if(eregi("[Ò»-龥]+",$str)){
echo"ÕâÊÇÒ»¸öºº×Ö";
}
?>
Ïà¹ØÎĵµ£º
<?php
class SubPages{
private $each_disNums;//ÿҳÏÔʾµÄÌõÄ¿Êý
private $nums;//×ÜÌõÄ¿Êý
private $current_page;//µ±Ç°±»Ñ¡ÖеÄÒ³
private $sub_pages;//ÿ´ÎÏÔʾµÄÒ³Êý
private $pageNums;//×ÜÒ³Êý
private $page_array = array();//ÓÃÀ´¹¹Ôì·ÖÒ³µÄÊý×é ......
´ó¼ÒºÃ£¬Çë½ÌÒ»¸öÎÊÌ⣬Âé·³ÓÐÀàËƾÑéµÄ°ï°ï棬лл¸÷λÁË!
±¾ÈËÒÔǰѧ¹ýÁ½ÄêµÄ.NET,ÓÃC#£¬ASP.NET£¬Winfrom,SQLServer×ö¹ý¼¸¸öÍøÕ¾ºÍСÐ͵ĹÜÀíϵͳ¡£
ÏÖÔÚµ½Ò»¼Òй«Ë¾£¬ÒªÇóÎÒѧPHP¡£Âé·³¸ßÊÖÖ¸µãһϣ¬P ......
ż¶û×ö¸ö¼òµ¥µÄWEB·þÎñ²âÊÔ³ÌÐò£¬ÎÒ»¹ÊÇϲ»¶²ÉÓÃPHP¡£¼ò½à£¬·ç¸ñºÍC/C++½Ó½ü£¬ÉÏÊֿ죬¶øÇÒ¿âÒ²ºÜÆëÈ«¡£ÒÔǰΪ¹ã¶«Òƶ¯×öÒƶ¯ÐÐÒµÖն˵ÄÑÝʾ³ÌÐòʱ£¬²ÉÓùúÄÚÒ»¸öÐÖµÜдµÄFleaPHP¿ªÔ´¿ò¼Ü£¬Á½Öܲ»µ½µÄʱ¼ä£¬ÎÒ´ÓÒ»¸ö¶ÔPHPÒ»ÎÞËùÖªµÄˮƽ£¬¿ìËٵĸ㶨ÁË30¶à¸öÒ³ÃæµÄºǫ́£¬ºóÀ´ÑÝʾЧ¹ûÒ²²»´í£¬Ò²ºÜÎȶ¨£¬´Ó´Ë¶ÔPHPÓÐÁ ......
ÓйØPHP
°²È«µÄ¼¸Ìõ¹æÔò
¹æÔò 1£º¾ø²»ÒªÐÅÈÎÍⲿÊý¾Ý»òÊäÈë
¹ØÓÚ Web Ó¦ÓóÌÐò°²È«ÐÔ£¬±ØÐëÈÏʶµ½µÄµÚÒ»¼þÊÂÊDz»Ó¦¸ÃÐÅÈÎÍⲿÊý¾Ý¡£ÍⲿÊý¾Ý£¨outside data£© °üÀ¨²»ÊÇÓɳÌÐòÔ±ÔÚ PHP
´úÂëÖÐÖ±½ÓÊäÈëµÄÈκÎÊý¾Ý¡£ÔÚ²ÉÈ¡´ëÊ©È·±£°²È«Ö®Ç°£¬À´×ÔÈκÎÆäËûÀ´Ô´£¨±ÈÈç GET ±äÁ¿¡¢±íµ¥ POST¡¢Êý¾Ý¿â¡¢ÅäÖÃÎļþ¡¢»á»°±äÁ¿»ò ......