¼ÌÐøÕª³£ºphpÒ³Ãæ·ÃÎÊʱ£¬Í³Ò»½øÐÐȨÏÞÑéÖ¤µÄÉè¼Æ
¡¡¡¡/***************************
¡¡¡¡* author : ´óÁäÇàÄê
¡¡¡¡* email : wenadmin@sina.com
¡¡¡¡* from: http://blog.csdn.net/hahawen
¡¡¡¡* תÔØÇë±£ÁôÕⲿ·ÖÐÅÏ¢£¬Ð»Ð»
¡¡¡¡***************************/
phpÒ³Ãæ·ÃÎÊʱ£¬Í³Ò»½øÐÐȨÏÞÑéÖ¤µÄÉè¼Æ
ÍíÉÏÓÐÈËÎÊÎÒ¹ØÓÚÍøÕ¾Ò³ÃæÏÔʾµÄʱºò£¬È¨ÏÞÅжϵÄÎÊÌâ¡£ÓÚÊǾÍÓÖÓÐÁËÕâƪÎÄÕ¡£
ÆäʵÕâ¸öÓкܶàÖеķ½Ê½À´ÊµÏÖ¡£
1£¬¿ÉÒÔÔÚÿ¸öÒ³ÃæÖж¼µ¥¶À½øÐÐȨÏÞÅжϣ¬Õâ¸öÊÇ×î´óÖڵķ½·¨¡£
2£¬¿ÉÒÔΪÿһ¸ö×îÖÕÒ³ÃæÎļþ¶¼×÷Ò»¸öÅäÖÃÎļþ£¬ÓÃÀ´½øÐÐȨÏÞÅжϣ¬µ±Óû§·ÃÎÊÕâ¸öÒ³ÃæµÄʱºò£¬Í¨¹ýÒ»¸öº¯ÊýÀ´Åжϣ¬ÊÇ·ñ´æÔÚÕâ¸öÎļþ¡£Èç¹û´æÔÚ£¬¾Í¸ù¾ÝÎļþµÄÄÚÈݽøÐÐȨÏÞÅжϣ¬Èç¹û²»´æÔÚ£¬¾Í²»ÓýøÐÐȨÏÞÅжϡ£
3£¬ÊÇͳһ×÷Åжϣ¬×öÒ»¸öµ¥¶ÀµÄº¯Êý£¬Í¨¹ýÒ»¶¨µÄÅäÖýøÐÐȨÏÞÅжϡ£
ÏÂÃæµÄÒ»¸öÀý×ÓÊǵÚÈýÖÖ·½·¨£¬ÕâÖÖ·½·¨ÊʺÏÓÚÈκεÄÇé¿ö£¬ÇұȽÏͨÓá£
²½ÖèÒ»¡¢ÕûÀí·ÃÎÊ·¾¶ÐÅÏ¢£¬°ÑÐèÒª½øÐÐȨÏÞÑéÖ¤µÄ·¾¶½øÐÐÕûÀí£¬ÕûÀí³ÉÒ»¸öÁбí
²½Öè¶þ¡¢ÕûÀíÐèÒª½øÐÐȨÏÞÑéÖ¤µÄ·ÖÀ࣬ΪÿһÖÖȨÏÞÑéÖ¤×÷Ò»¸öµ¥¶ÀµÄº¯Êý£¬
²½ÖèÈý¡¢°Ñ “·ÃÎÊ·¾¶”ºÍ “ȨÏÞÑéÖ¤º¯Êý”µÄ¶ÔÓ¦¹Øϵ£¬°´ 1:1 дµ½Ò»¸öÅäÖÃÎļþ»òÊÇÊý×éÀïÃ棬ÀýÈçÏÂÃæµÄ filter.php ÀïÃæµÄ $filter Êý×é
²½ÖèËÄ¡¢×öÒ»¸öÑéÖ¤º¯Êý£¬½âÎöµ±Ç°µÄ·ÃÎÊ·¾¶£¬½øÐÐȨÏÞÅжϡ£
¼òÊö£¬filter.phpÊÇÓÃÀ´°üº¬ËùÒÔÑéÖ¤ÐÅÏ¢µÄÎļþ£¬authorization()ÊÇÒ»¸öºËÐĵĵ÷¶Èº¯Êý£¬Çë×¢Òâ¿´º¯ÊýÀïÃæµÄ˵Ã÷£¬application.php ÊÇÒ»¸öÆÕͨµÄÒ³ÃæÎļþ¡£Àý×ÓÖеĺ¯Êý¶¼Ã»ÓоßÌåʵÏÖ£¬×Ô¼º²¹³ä°É¡£
ÎļþÒ»¡¢filter.php
<?php
$filter = array('/admin' => 'adminLogin',
'/admin/userAdmin' => 'powerAdminLogin',
'/myshop' => 'userLogin'
);
function adminLogin(){
// return 'ÊǹÜÀíÔ±Âð'? 'SUCCESS': 'FALSE';
}
function powerAdminLogin(){
// return 'Êdz¬¼¶¹ÜÀíÔ±Âð'? 'SUCCESS': 'FALSE';
}
function userLogin(){
// return 'ÊÇ»áÔ±Âð'? 'SUCCESS': 'FALSE';
}
function authorization(){
global $filter;
// È¡³ö ²¢ ½âÎö µ±Ç°·ÃÎʵÄurl·¾¶£¬ÅÐ¶Ï $filter ÀïÃ
Ïà¹ØÎĵµ£º
×Ö·û´®µÄд·¨
×Ö·û´®ÒÔµ¥¡¢Ë«»òµ¹ÒýºÅΧס·Ö±ðÓв»Í¬µÄÒåÒâ¡£
µ¥ÒýºÅ
ÀýÈ磺
$str = 'An apple a day keeps the docter away.'
µ±×Ö·û´®³öÏÖ ' ·ûºÅʱ£¬±ØÐë¼ÓÉÏ£º
'I'm wing'
Ó¦¸Ä³É£º
'I'm wing'
²Å¶Ô£¬ÆäÖÐ ' ¼´³ÆΪÌøÍÑ×Ö·û (escape character)¡£
Ë«ÒýºÅ
ÒÔË«ÒýºÅΧסµÄ×Ö·û´® PHP »á¶Ô¸Ã×Ö·û´®× ......
php³£ÓÃÀàÕûÀí
ʱ¼ä£º2009-12-19 20:45 À´Ô´£ºÈËÁ¦·½ ×÷Õߣºsyuanq µã»÷£º548
ÔÚʵ¼Ê¿ª·¢¹ý³Ì»á¾³£»áÓöµ½Ò»Ð©Öظ´µÄ²Ù×÷£¬Èç¹ûÿ´Î¶¼Òª×Ô¼ºÈ¥ÊµÏÖÕâÎÞÒɼÓÖØÁË×Ô¼ºµÄ¹¤×÷Á¿£¬ÏÂÃæ¶ÔһЩ¿ÉÄܾ³£Óõ½µÄÀà×ö¸öÕûÀí£º
ͼ±í¿â
ÏÂÃæµÄÀà¿â¿ÉÒÔÈÃÄãºÜ¼òµ¥¾ÍÄÜ´´½¨¸´ÔÓµÄͼ±íºÍͼƬ¡£µ±È»£¬ËüÃÇÐèÒªGD¿âµÄÖ§³Ö ......
AddSlashes: ×Ö·û´®¼ÓÈëбÏß¡£
bin2hex: ¶þ½øλת³ÉÊ®Áù½øλ¡£
Chop: È¥³ýÁ¬Ðø¿Õ°×¡£
Chr: ·µ»ØÐòÊýÖµµÄ×Ö·û¡£
chunk_split: ½«×Ö·û´®·Ö³ÉС¶Î¡£
convert_cyr_string: ת»»¹Å˹À·ò×Ö·û´®³ÉÆäËü×Ö·û´®¡£
crypt: ½«×Ö·û´®Óà DES ±àÂë¼ÓÃÜ¡£
echo: Êä³ö×Ö·û´®¡£
explode: Çпª×Ö·û´®¡£
flush: Çå³öÊä³ö»º³åÇø¡£
get ......
££££££££££££££
°²×°pear
££££££££££££££
pearÊÇPHPµÄÀ©Õ¹ºÍÓ¦ÓóÌÐò¿â£¬°üº¬Á˺ܶàÓÐÓõÄÀ࣬°²×°ºÃphp5.0ºó£¬pearʵ¼ÊÉϲ¢Ã»Óб»°²×°£¬°²×°µÄ·½·¨ÈçÏ£º
1.ÔÚphpĿ¼ÖÐË«»÷go-pear.bat¡£
2.°´ÕÕÌáʾÊäÈëһЩÉèÖÃÐÅÏ¢£¬ ......
header("HTTP/1.0 400 Bad Request");¡¡·µ»Ø400´íÎó
header("HTTP/1.0 404 Not Found"); ·µ»Ø404´íÎó
header("Location:http://$host$uri/$extra"); Ìøת
//ÉèÖÃnocache¡¡£¬¹ýÆÚ
header
(
"Cache-Control: no-cache,
must-revalidate"
);
//
HTTP/1.1
header
(
&q ......