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 µ±ÈÃÒ²ÓÐApacheÁË¡£µ«ÊÇÎÒÓöµ½ÁËÒ»¸öÎÊÌ⣬¾ÍÊÇApache·þÎñÎÞ·¨¿ªÆô£¬ºó¹ûÔõÑùÎÒÏëºÜ¶àÈ˶¼ÊÇÖªµÀµÄ£¬µ±Ê±Ò²Ã»ÓжàÏ룬ÒÔΪÊÇ×Ô¼º°²×°µÄʱºò³öÏÖÁËʧÎó¾ÍÖØÐ°²×°Ò»±é£¬¿ÉÊÇ»¹ÊÇÒ»ÑùÎÞ·¨´ò¿ª£¬È»ºóÎÒ¾ÍÔÚÏëÊÇʲôÎÊÌ⣬¶Ë¿ÚºÅ80.ÎҲ鿴ÁËһϣ¬·¢ÏÖûÓдíÎó°¡£¬Ë¼¿¼Á˺ܾ㬶ÔÍøÂçÒÔ¼°·À» ......
×î¼òµ¥µÄ˶¼»áµÄµ÷ÊÔ(ÊÇô?):
±¾À´°²×°phpÊÇûÎÊÌâ Ò²ÄÜÓÃÁË µ«ÊÇÓÖ´ÓÊéÉϳÁËһЩ´úÂëÀ´·¢ÏÖ²»ÄÜÓÃ, ÄǾÍÓÃÑÛ¾¦×ÐϸµÄ¶Ô×ÅÊé±¾¾ÀÕýһϴúÂë¹þ ¿Ï¶¨ÊÇÄã³´íÁË ÒªÃ´ÊÇÓ¡Ë¢´íÁË
±ÈÈç 1(yi)¸úl(el) 0(ling)¸úO(´óдo)µÈ
±ðЦ¹þ ÕæµÄÓÐÈ˳´í¹ý »¹ÈÃÎÒ¹ýÈ¥°ïæµ÷ÊÔ ¹ýÈ¥ÎÒ¼Èë½øÈ¥(ËûµÄû±£´æ) ¾ÍÈ«¶ÔÁË
ÑÔ¹éÕý´«
Q: "Ϊ ......
class A extends father{
function __construct() {
echo "abstract<br>";
parent::base(); //¸¸Àà·½·¨
&nb ......
<?
php define('__TYPECHO_ROOT_DIR__', dirname(__FILE__));
define('__TYPECHO_PLUGIN_DIR__', '/usr/plugins');
@set_include_path(get_include_path() . PATH_SEPARATOR . __TYPECHO_ROOT_DIR__ . '/var' . PATH_SEPARATOR . __TYPECHO_ROOT_DIR__ . __TYPECHO_PLUGIN_DIR__);
ÄÜÏêϸµÄ½âÊÍÕâ¸öº¯ÊýÂ𣿵±È»Î ......
ÍêÕûµÄʵÏÖÁËPHP½«Í¼Æ¬´æÈëMYSQL
ǰÌ᣺
1 Ê×ÏȱØÐëÓµÓÐPHPµÄÔËÐл·¾³£¬ÁíÍ⻹µÃÓÐMYSQLÊý¾Ý¿â
2 Èç¹ûÎļþ²»ÄÜÉÏ´«³É¹¦Çë¼ì²épicsÊÇ·ñÊÇ¿ÉдµÄȨÏÞ
Ê×ÏÈÏȰÑpic2db.rarÎļþ½âѹµ½PHP¿ÉÒÔÔËÐÐĿ¼Ï¡£
Æä´ÎÔÚMYSQLÖн¨Á¢Ò»¸öÊý¾Ý¿â:pic2db,È»ºóÔÚ¸ÃÊý¾Ý¿âϽ¨Á¢Ò»¸ö±í£¬±í½á¹¹Îª£º
CREATE TABLE `pi ......