php ģʽÐÞÕý·û
ģʽÐÞÕý·û — ½â˵ÕýÔò±í´ïʽģʽÖÐʹÓõÄÐÞÕý·û
˵Ã÷
ÏÂÃæÁгöÁ˵±Ç°ÔÚ PCRE ÖпÉÄÜʹÓõÄÐÞÕý·û¡£À¨ºÅÖÐÊÇÕâЩÐÞÕý·ûµÄÄÚ²¿ PCRE Ãû¡£ÐÞÕý·ûÖеĿոñºÍ»»Ðб»ºöÂÔ£¬ÆäËü×Ö·û»áµ¼Ö´íÎó¡£
i (PCRE_CASELESS) Èç¹ûÉ趨´ËÐÞÕý·û£¬Ä£Ê½ÖеÄ×Ö·û½«Í¬Ê±Æ¥Åä´óСд×Öĸ¡£ m£¨PCRE_MULTILINE£© ĬÈÏÇé¿öÏ£¬PCRE ½«Ä¿±ê×Ö·û´®×÷Ϊµ¥Ò»µÄÒ»“ÐД×Ö·ûËù×é³ÉµÄ£¨ÉõÖÁÆäÖаüº¬Óл»ÐзûÒ²ÊÇÈç´Ë£©¡£“ÐÐÆðʼ”Ôª×Ö·û£¨^£©½ö½öÆ¥Åä×Ö·û´®µÄÆðʼ£¬“ÐнáÊø”Ôª×Ö·û£¨$£©½ö½öÆ¥Åä×Ö·û´®µÄ½áÊø£¬»òÕß×îºóÒ»¸ö×Ö·ûÊÇ»»ÐзûʱÆäÇ°Ã棨³ý·ÇÉ趨ÁË D ÐÞÕý·û£©¡£ÕâºÍ Perl ÊÇÒ»ÑùµÄ¡£ µ±É趨ÁË´ËÐÞÕý·û£¬“ÐÐÆðʼ”ºÍ“ÐнáÊø”³ýÁËÆ¥ÅäÕû¸ö×Ö·û´®¿ªÍ·ºÍ½áÊøÍ⣬»¹·Ö±ðÆ¥ÅäÆäÖеĻ»ÐзûµÄÖ®ºóºÍ֮ǰ¡£ÕâºÍ Perl µÄ /m ÐÞÕý·ûÊǵÈЧµÄ¡£Èç¹ûÄ¿±ê×Ö·û´®ÖÐûÓГ\n”×Ö·û»òÕßģʽÖÐûÓÐ ^ »ò $£¬ÔòÉ趨´ËÐÞÕý·ûûÓÐÈκÎЧ¹û¡£ s£¨PCRE_DOTALL£© Èç¹ûÉ趨ÁË´ËÐÞÕý·û£¬Ä£Ê½ÖеÄÔ²µãÔª×Ö·û£¨.£©Æ¥ÅäËùÓеÄ×Ö·û£¬°üÀ¨»»Ðзû¡£Ã»ÓдËÉ趨µÄ»°£¬Ôò²»°üÀ¨»»Ðзû¡£ÕâºÍ Perl µÄ /s ÐÞÕý·ûÊǵÈЧµÄ¡£Åųý×Ö·ûÀàÀýÈç [^a] ×ÜÊÇÆ¥Åä»»ÐзûµÄ£¬ÎÞÂÛÊÇ·ñÉ趨ÁË´ËÐÞÕý·û¡£ x£¨PCRE_EXTENDED£© Èç¹ûÉ趨ÁË´ËÐÞÕý·û£¬Ä£Ê½ÖеĿհ××Ö·û³ýÁ˱»×ªÒåµÄ»òÔÚ×Ö·ûÀàÖеÄÒÔÍâÍêÈ«±»ºöÂÔ£¬ÔÚδתÒåµÄ×Ö·ûÀàÖ®ÍâµÄ # ÒÔ¼°ÏÂÒ»¸ö»»ÐзûÖ®¼äµÄËùÓÐ×Ö·û£¬°üÀ¨Á½Í·£¬Ò²¶¼±»ºöÂÔ¡£ÕâºÍ Perl µÄ /x ÐÞÕý·ûÊǵÈЧµÄ£¬Ê¹µÃ¿ÉÒÔÔÚ¸´ÔÓµÄģʽÖмÓÈë×¢ÊÍ¡£È»¶ø×¢Ò⣬Õâ½öÊÊÓÃÓÚÊý¾Ý×Ö·û¡£¿Õ°××Ö·û¿ÉÄÜÓÀÔ¶²»»á³öÏÖÓÚģʽÖеÄÌØÊâ×Ö·ûÐòÁУ¬ÀýÈçÒýÈëÌõ¼þ×ÓģʽµÄÐòÁÐ (?( Öм䡣 e Èç¹ûÉ趨ÁË´ËÐÞÕý·û£¬preg_replace() ÔÚÌæ»»×Ö·û´®ÖжÔÄæÏòÒýÓÃ×÷Õý³£µÄÌæ»»£¬½«Æä×÷Ϊ PHP ´úÂëÇóÖµ£¬²¢ÓÃÆä½á¹ûÀ´Ìæ»»ËùËÑË÷µÄ×Ö·û´®¡£
Ö»ÓÐ preg_replace() ʹÓôËÐÞÕý·û£¬ÆäËü PCRE º¯Êý½«ºöÂÔÖ®¡£
Note: ±¾ÐÞÕý·ûÔÚ PHP3 Öв»¿ÉÓá£
A£¨PCRE_ANCHORED£© Èç¹ûÉ趨ÁË´ËÐÞÕý·û£¬Ä£Ê½±»Ç¿ÖÆΪ“anchored”£¬¼´Ç¿Öƽö´ÓÄ¿±ê×Ö·û´®µÄ¿ªÍ·¿ªÊ¼Æ¥Åä¡£´ËЧ¹ûÒ²¿ÉÒÔͨ¹ýÊʵ±µÄģʽ±¾ÉíÀ´ÊµÏÖ£¨ÔÚ Perl ÖÐʵÏÖµÄΨһ·½·¨£©¡£ D£¨PCRE_DOLLAR_ENDONLY£© Èç¹ûÉ趨ÁË´ËÐÞÕý·û£¬Ä£Ê½ÖеÄÃÀÔªÔª×Ö·û½öÆ¥ÅäÄ¿±ê×Ö·û´®µÄ½áβ¡£Ã»ÓдËÑ¡Ïîʱ£¬Èç¹û×îºóÒ»¸ö×Ö·ûÊÇ»»ÐзûµÄ»°£¬ÃÀÔª·ûºÅÒ²»áÆ¥Åä´Ë×Ö·û֮ǰ£¨µ«²»»áÆ¥ÅäÈκÎÆäËü»»Ðзû֮ǰ£©¡£Èç¹ûÉ趨Á
Ïà¹ØÎĵµ£º
1.Èç¹ûÒ»¸ö·½·¨Äܱ»¾²Ì¬£¬ÄǾÍÉùÃ÷ËûΪ¾²Ì¬µÄ£¬ËٶȿÉÌá¸ß1/4;
2.echoµÄЧÂʸßÓÚprint,ÒòΪechoûÓзµ»ØÖµ£¬print·µ»ØÒ»¸öÕûÐÍ;
3.ÔÚÑ»·Ö®Ç°ÉèÖÃÑ»·µÄ×î´ó´ÎÊý£¬¶ø·ÇÔÚÔÚÑ»·ÖÐ;
4.Ïú»Ù±äÁ¿È¥ÊÍ·ÅÄڴ棬ÌرðÊÇ´óµÄÊý×é;
5.±ÜÃâʹÓÃÏñ__get, __set, __autoloadµÈħÊõ·½·¨;
6.requiere_once()±È½ÏºÄ×ÊÔ´;
7.ÔÚi ......
http://www.juqng.com/articles/php/php-kai-fa-kuang-jia-jie-shao/
PHP¿ª·¢¿ò¼Ü½éÉÜ
×÷Õß: juqng.com
2009-12-08
phpÊǷdz£Á÷ÐеĿªÔ´Ãâ·ÑÓïÑÔ£¬ËüµÄ¿ª·¢¿ò¼ÜÒ²ÊǷdz£¶àµÄ£¬ÕâÀï½éÉÜһЩÓÅÐãµÄPHP¿ª·¢¿ò¼Ü¡£
CodeIgniter
ÊÇÒ»¸öÇ¿´óµÄPHPÓëÌå»ý·Ç³£Ð¡µÄ¡£ÎªPHP³ÌÐòÔ±£¬Ìṩһ¸ö¼òµ¥¶øÓÅÑÅ´´½ ......
ÔÚʹÓÃÉÏ´«Îļþʱ£¬½«ÉÏ´«µÄ´úÂë·â×°³ÉÀ࣬¸üÈÝÒ×·½±ã¡£
190.php
<?php
require('upload.php');
if($_POST['submit']){
$a = new Upload();
$File = $a -> uploadfile($ARG=array(
'File'=>array(
'name' => $_FILES['fileDoc']['name'], //Ô ......
<?php
echo "<br>";
?>
<?php
function GetIP()
{
if(!empty($_SERVER["HTTP_CLIENT_IP"]))
$cip = $_SERVER["HTTP_CLIENT_IP"];
else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
$cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
else if(!empty($_SERVER ......