phpÖеÄevalºÍJavaScriptÖеÄeval
phpÖеÄevalºÍJavaScriptÖеÄevalÇø±ð£º
Definition and Usage
¶¨ÒåºÍÓ÷¨
The eval() function evaluates a
string as PHP code.
eval()º¯ÊýµÄ×÷ÓÃÊÇ£º·µ»ØÓëPHP´úÂëÏà¶ÔÓ¦µÄ×Ö·û´®¡£
The string
must be valid PHP code and must end with semicolon.
Õâ¸ö×Ö·û´®±ØÐëÊÇÓÐЧµÄPHP´úÂ룬
²¢ÇÒ±ØÐëÒԷֺŽáÊø¡£
This function returns NULL unless a return statement is
called in the code string. Then the value passed to return is returned.
If there is a parse error in the code string, eval() returns FALSE.
³ý
ÁËÔÚ´úÂë×Ö·û´®ÖÐÇëÇó“·µ»ØÓï¾ä[return
statement]”µÄÇé¿ö£¬ÔÚÆäËüÇé¿öÏ£¬Õâ¸öº¯Êý¶¼½«·µ»Ø¿ÕÖµ[NULL]£»Èç¹ûÇëÇóÁË“·µ»ØÓï¾ä”£¬ÄÇôËü½«·µ»Ø±»´«µÝµ½“·µ»ØÓï¾ä”ÖеÄÖµ¡£Èç
¹ûÕâ¶Î´úÂë×Ö·û´®³öÏÖ´íÎó£¬eval()º¯Êý½«·µ»ØFalse¡£
eval()º¯Êý£¬Õâ¸öº¯Êý¿ÉÒÔ°ÑÒ»¸ö×Ö·û´®µ±×÷Ò»¸öJavaScript±í´ïʽһÑùÈ¥Ö´ÐÐËü¡£
¿ÉÒÔ½«×Ö·û´®µÄÐÎʽת»»³ÉÊýÖµÐ͵È
ob_start() ob_end_clean() ob_get_contents()
(2008-12-19 16:17:41)
תÔØ
±êÇ©£º
»º³åÇø
start
±äÁ¿
work
ob_start
ob_end_clean
it
·ÖÀࣺ
php
ʹÓÃob_start()°ÑÊä³öÄÚÈÝÊä³öµ½»º³åÇø£¬¶ø²»Êǵ½ä¯ÀÀÆ÷¡£
È»ºóÓÃob_get_contentsµÃµ½»º³åÇøµÄÊý¾Ý¡£
ob_start()ÔÚ·þÎñÆ÷´ò¿ªÒ»¸ö»º³åÇøÀ´±£´æËùÓеÄÊä³ö¡£ËùÒÔÔÚÈκÎʱºòʹ
ÓÃecho
£¬Êä³ö¶¼½«±»¼ÓÈ뻺³åÇøÖУ¬Ö±µ½³ÌÐòÔËÐнáÊø»òÕßʹÓÃob_flush()À´½áÊø¡£È»ºóÔÚ·þÎñÆ÷Öлº³åÇøµÄÄÚÈݲŻᷢË͵½ä¯ÀÀÆ÷£¬ÓÉä¯ÀÀÆ÷À´½âÎöÏÔʾ¡£
º¯Êýob_end_clean
»áÇå³ý»º³åÇøµÄÄÚÈÝ£¬²¢½«»º³åÇø¹Ø±Õ£¬µ«²»»áÊä³öÄÚÈÝ¡£
´ËʱµÃÓÃÒ»¸öº¯Êýob_get_contents()ÔÚob_end_clean()Ç°ÃæÀ´»ñµÃ»º³åÇøµÄÄÚÈÝ¡£
ÕâÑùµÄ»°£¬
Äܽ«ÔÚÖ´ÐÐob_end_clean()Ç°°ÑÄÚÈݱ£´æµ½Ò»¸ö±äÁ¿ÖУ¬È»ºóÔÚob_end_clean()ºóÃæ¶ÔÕâ¸ö±äÁ¿×ö²Ù×÷¡£
ÕâÊÇEG£º
ob_start(); // buf1
echo ' multiple ';
ob_start(); // buf2
echo ' buffers work ';
$buf2 = ob_get_contents();
ob_end_clean();
$buf1 = ob_get_contents();
ob_end_clean();
echo $buf1;
echo '<br/>';
echo $buf2;
function
format_js($string ,$isjs){
$string =
addslashes(str_replace(array('\n','\r'),array('',''),$string));
return $isjs?'document.wirte("$string");':$str
Ïà¹ØÎĵµ£º
javascriptÈëÃÅ»ù´¡ÖªÊ¶
ÎÄÕÂÔ´ÓÚ²©¿Í£ºhttp://www.cnblogs.com/seesky/articles/1433526.html
ÔÚÍøÕ¾ÖÆ×÷µÄ¹ý³ÌÖо³£ÐèÒªÓõ½JavaScriptÓï¾ä£¬ÕÆÎÕһЩÏà¹ØµÄJavaScript½á¹¹¶ÔÍøÕ¾ÖÆ×÷ÓÐ×ÅÖصÄÖØÓã¡
1.document.write(""); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document->html->(head,body)
......
ÉùÃ÷£º²¿ÊðDedeCMS£¬ÔÚÍøÉÏËÑÁ˺ܶà×ÊÁÏ£¬°üÀ¨Õâ¸öÂÛ̳£¬¼¸ºõûÓз¢ÏÖÔÚlinuxϲ¿ÊðµÄÏÖ³É×ÊÁÏ¿ÉÒԲο¼¡£
Ë죬×Ô¼º°ÑÕû¸ö²¿Êð¹ý³ÌÖÐһЩÖØÒªµÄµã¼Ç¼ÏÂÀ´£¬Ò»ÊÇËã×ö×Ô¼ºµÄÀͶ¯³É¹û£¬Í¬Ê±£¬ÆÚÍû¶ÔÔø¾ºÍÎÒÒ»ÑùÃÔ㣬²»ÖªÈçºÎ²¿Êð   ......
PHP±à³ÌÖо³£ÐèÒªÓõ½Ò»Ð©·þÎñÆ÷µÄһЩ×ÊÁÏ£¬ÌØ°Ñ$_SERVERµÄÏêϸ²ÎÊýÕûÀíÏ£¬·½±ãÒÔºóʹÓá£
$_server ´úÂë
1. $_SERVER['PHP_SELF'] #µ±Ç°ÕýÔÚÖ´Ðнű¾µÄÎļþÃû£¬Óë document rootÏà¹Ø¡£
2. $_SERVER['argv'] # ´«µÝ¸ø¸Ã½Å±¾µÄ²ÎÊý¡£
3. $_SERVER['argc'] # °üº¬´«µÝ¸ø³ÌÐòµÄÃüÁîÐвÎÊýµÄ¸öÊý£¨Èç¹ûÔËÐÐ ......
ÎÞÂÛÄÄÖÖÓïÑÔ£¬×Ö·û´®²Ù×÷¶¼ÊÇÒ»¸öÖØÒªµÄ»ù´¡£¬ÍùÍùÊǼòµ¥¶øÖØÒª¡£ÕýÏñÈË˵»°Ò»Ñù£¬Ò»°ãÓÐÐÎÌ壨ͼÐνçÃ棩£¬ÓÐÓïÑÔ£¨print ×Ö·û´®£¿£©£¬ÏÔÈ»×Ö·û´®ÄܽâÊ͸ü¶àµÄ¶«Î÷¡£PHPÌṩÁË´óÁ¿µÄ×Ö·û´®²Ù×÷º¯Êý£¬¹¦ÄÜÇ¿´ó£¬Ê¹ÓÃÒ²±È½Ï¼òµ¥£¬ÏêϸÇë²Î¿´ http://cn2.php.net/manual/zh/ref.strings.php . ÒÔϽ«¼òµ¥µÄ½²ÊöËüµÄ¹¦ÄܺÍÌØÐ ......
php evalº¯ÊýÓ÷¨----PHPÖÐeval()º¯ÊýС¼¼ÇÉ
eval
½«Öµ´úÈë×Ö·û´®Ö®ÖС£
Óï·¨: void eval(string code_str);
´«»ØÖµ: ÎÞ
º¯Ê½ÖÖÀà: Êý¾Ý´¦Àí
ÄÚÈÝ˵Ã÷
±¾º¯Ê½¿É½«×Ö·û´®Ö®ÖеıäÁ¿Öµ´úÈ룬ͨ³£ÓÃÔÚ´¦ÀíÊý¾Ý¿âµÄÊý¾ÝÉÏ¡£²ÎÊý code_str ΪÓû´¦ÀíµÄ×Ö·û´®¡£ÖµµÃ×¢ÒâµÄÊÇ´ý´¦ÀíµÄ×Ö·û´®Òª·ûºÏ PHP µÄ×Ö·û´®¸ñʽ£¬Í¬Ê±ÔÚ½ ......