ÓÃphp¹ýÂË±íµ¥Ìá½»ÖеÄΣÏÕhtml´úÂë
ÓÃPHP¹ýÂËÌá½»±íµ¥µÄhtml´úÂëÀï¿ÉÄÜÓб»ÀûÓÃÒýÈëÍⲿΣÏÕÄÚÈݵĴúÂë¡£ÀýÈ磬ÓÐЩʱºòÓû§Ìá½»±íµ¥Öк¬ÓÐhtmlÄÚÈÝ£¬µ«Õâ¿ÉÄÜÔì³ÉÏÔʾҳÃæ²¼¾Ö»ìÂÒ£¬ÐèÒª¹ýÂ˵ô¡£
ÒÔÏÂÊdzÌÐò´úÂ룺
¸´ÖÆ´úÂë
function uhtml($str)
{
$farr = array(
"/\s+/", //¹ýÂ˶àÓà¿Õ°×
//¹ýÂË <script>µÈ¿ÉÄÜÒýÈë¶ñÒâÄÚÈÝ»ò¶ñÒâ¸Ä±äÏÔʾ²¼¾ÖµÄ´úÂë,Èç¹û²»ÐèÒª²åÈëflashµÈ,»¹¿ÉÒÔ¼ÓÈë<object>µÄ¹ýÂË
"/<(\/?)(script|i?frame|style|html|body|title|link|meta|\?|\%)([^>]*?)>/isU",
"/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU",//¹ýÂËjavascriptµÄonʼþ
);
$tarr = array(
" ",
"£¼\1\2\3£¾",//Èç¹ûÒªÖ±½ÓÇå³ý²»°²È«µÄ±êÇ©£¬ÕâÀï¿ÉÒÔÁô¿Õ
"\1\2",
);
$str = preg_replace( $farr,$tarr,$str);
return $str;
}
Ïà¹ØÎĵµ£º
¿ÉÒÔ½«Êý×éºÍ¶ÔÏóÖ±½Ó´æÈëÊý¾Ý¿âÖеÄijһ×ֶΡ£
ʹserialize()Êǽ«Êý×é·´ÐòÁл¯ÔÙ´æÈëÊý¾Ý¿â£¬ÐòÁл¯»°ÍêµÄÊý¾Ý¾ÍÊÇÒ»¸ö×Ö·û´®¡£
ÌáÈ¡µÄʱºò£¬ÓÃunserialize()·´ÐòÁл¯È¡£¬È¡³öÀ´µÄ»¹ÊǸöÊý×é¡£
$arr = array('value1','value2','value3');
$str = serialize($arr); //ÐòÁл¯
$new_str = unserialize($temp); //·´ÐòÁÐ ......
php°æ£º
<?php
$cookie_file = fopen('cookie.txt','w');//dirname(__FILE__)."/cookie_".md5(basename(__FILE__)).".txt"; // ÉèÖÃCookieÎļþ±£´æ·¾¶¼°ÎļþÃû
function vlogin($url,$data){ // Ä£ÄâµÇ¼»ñÈ¡Cookieº¯Êý
$curl = curl_init(); // Æô¶¯Ò»¸öCURL»á»°
curl_setopt($cur ......
ÒÔϹØÓڴ˺¯Êý¸÷ÏîʹÓòÎÊý:
bool curl_setopt (int ch, string option, mixed value)
curl_setopt()º¯Êý½«ÎªÒ»¸öCURL»á»°ÉèÖÃÑ¡Ïî¡£option²ÎÊýÊÇÄãÏëÒªµÄÉèÖã¬valueÊÇÕâ¸öÑ¡Ïî¸ø¶¨µÄÖµ¡£
ÏÂÁÐÑ¡ÏîµÄÖµ½«±»×÷Ϊ³¤ÕûÐÎʹÓÃ(ÔÚoption²ÎÊýÖÐÖ¸¶¨)£º
CURLOPT_INFILESIZE
: µ±ÄãÉÏ´«Ò»¸öÎļþµ½Ô¶³ÌÕ¾µã£¬Õâ¸öÑ¡Ï ......
һѡÔñÌ⣺
1.ÏÂÃæµÄÄǸöÑ¡Ïî¿ÉÒÔ»ñÈ¡±íµ¥Ìá½»µÄÖµ£¿£¨¶àÑ¡£© b d
<form name='frm1' method="post">
<input type="text" name="name" ><input type="submit" name="a">
</form>
A.$_GET['name']
B.$_POST['name']
C.$_SESSION['name']
D.$_REQUEST['name']
E.$_GLOBAL['name']
2.ÍüÀ²¡£ ......