PHP ²¢·¢¿ØÖÆÑùÀý£¨×ª£©
ÖµµÃ²Î¿¼Ò»Ï¸óÌÐòÉè¼ÆµÄ˼·£º
[ÎÄÕÂ×÷ÕߣºÕÅÑç ±¾ÎÄ°æ±¾£ºv1.0 ×îºóÐ޸ģº2007.11.16 תÔØÇë×¢Ã÷³ö´¦£ºhttp://blog.s135.com]
¡¡¡¡×î½üÓöµ½Ò»¸öÎÊÌ⣬LinuxϵÄPHPÃüÁîÐгÌÐò×÷ΪÊØ»¤½ø³Ì£¬ÐèÒª´Ó¶ÓÁÐÎļþÖжÁÒ»ÐÐÊý¾Ý£¬Í¨¹ýTCPÐÒé·¢Ë͸øÍâµØµÄ½ÓÊÕ·þÎñÆ÷£¬ÔÙ¶ÁÏÂÒ»ÐÐÊý¾Ý£¬ÔÙ·¢ËÍ¡£µ±±¾µØÓëÍâµØµÄÍøÂç×´¿ö²»ºÃʱ£¬ÓÐʱºò·¢ËÍÒ»ÌõÊý¾ÝËùºÄ·ÑµÄʱ¼ä¾Í½Ï³¤£¬ÀÛ»ýÆðÀ´ÈÝÒ×Ôì³É¶ÓÁжÂÈûºÍÑÓ³Ù¡£
¡¡¡¡ÓÚÊÇ£¬ÎÒ×¼±¸ÓøÃPHPÃüÁîÐгÌÐòÉú³É¶à¸ö×Ó½ø³Ì£¬½«´®Ðд¦Àí±ä³É²¢Ðд¦Àí¡£×î¼òµ¥µÄ·½·¨¾ÍÊÇÔÚPHPÖÐÓÃexec()»òpopen()º¯Êý½«Ò»¸öshellÃüÁîÐÐÍƵ½ºǫ́ȥִÐУ¬ÀýÈ磺
<?php
exec("/bin/sh /opt/zhangyan.sh &");
?>
¡¡¡¡×îºóµÄ&±íʾ½«shell½Å±¾ÍƵ½ºǫ́ȥִÐС£
¡¡¡¡µ«ÊÇÕâÑù»áÓÐÒ»¸öÎÊÌ⣬Èç¹ûÍƵ½ºǫ́µÄ½ø³ÌÌ«¶à£¬¿ÉÄܻᵼÖ·þÎñÆ÷ϵͳ×ÊÔ´ºÄ¾¡¶ø±ÀÀ££¬ËùÒÔ±ØÐë¿ØÖƽø³ÌÊýÁ¿¡£
¡¡¡¡ÎÒдÁËÒ»¸öPHP³ÌÐò£¨/opt/zhangyan.php£©¡¢Ò»¸öshell³ÌÐò£¨/opt/zhangyan.sh£©×÷Ϊ²âÊÔÓÃÀý¡£
¡¡¡¡³ÌÐòµÄÂß¼£º
¡¡¡¡1¡¢ÉèÖÃ/opt/zhangyan.php×î¶àÔÊÐíÉú³É500¸ö×Ó½ø³Ì£»
¡¡¡¡2¡¢µ±/opt/zhangyan.php¶ÁÈ¡µ½Ò»ÌõÊý¾Ýºó£¬½«ÔÊÐíÉú³ÉµÄ×Ó½ø³ÌÊý¼õ1£¨¿ÕÏнø³ÌÊý$p_number=500-1=499£©£¬È»ºó½«Êý¾Ý½»¸ø/opt/zhangyan.shÈ¥ºǫ́´¦Àí£¬²»µÈ´ý/opt/zhangyan.sh´¦Àí½áÊø£¬¼ÌÐø¶ÁÈ¡ÏÂÒ»ÌõÊý¾Ý£»
¡¡¡¡3¡¢µ±ÔÊÐíÉú³ÉµÄ×Ó½ø³ÌÊý¼õÖÁ0ʱ£¨¿ÕÏнø³ÌÊý$p_number=0£©£¬/opt/zhangyan.php»áµÈ´ý1ÃëÖÓ£¬È»ºó¼ì²éºǫ́»¹ÓжàÉÙ¸ö/opt/zhangyan.sh×Ó½ø³ÌÉÐδ´¦Àí½áÊø£»
¡¡¡¡4¡¢Èç¹û1ÃëÖÓÖ®ºó/opt/zhangyan.php·¢ÏÖºǫ́µÄ/opt/zhangyan.sh×Ó½ø³ÌÊý»¹ÊÇ500£¨¿ÕÏнø³ÌÊý$p_number=0£©£¬»á¼ÌÐøµÈ´ý1ÃëÖÓ£¬Èç´Ë·´¸´£»
¡¡¡¡5¡¢Èç¹û/opt/zhangyan.php·¢ÏÖºǫ́ÉÐδ´¦Àí½áÊøµÄ/opt/zhangyan.sh×Ó½ø³ÌÊý¼õÉÙµ½300¸öÁË£¨¿ÕÏнø³ÌÊý$p_number=500-300=200£©£¬ÄÇô/opt/zhangyan.php»áÔÙÍùºǫ́ÍÆËÍ200¸ö/opt/zhangyan.sh×Ó½ø³Ì£»
/opt/zhangyan.php´úÂëÈçÏ£º
view plainprint?
<?php
function run($input)
{
global $p_number;
if ($p_number <= 0)
{
$p_number = worker_processes($p_number);
&n
Ïà¹ØÎĵµ£º
The define() function defines a constant.
define()º¯ÊýµÄ×÷ÓÃÊÇ£º¶¨ÒåÒ»¸ö³£Á¿¡£
Constants are much like variables, except for the following differences:
³£Á¿[constant]Óë±äÁ¿[variable]ÓкܶàÏàËƵĵط½£¬Òò´Ë£¬ºÜÈÝÒ×»ìÏý£»ÏÂÃ棬ÎÒÃÇÁоÙһϳ£Á¿[constant]Óë±äÁ¿[variable]Ö®¼äµÄ²»Í¬µã£º
A constant's ......
1.ʲôÊÇMVC£¿
MVC±¾À´ÊÇ´æÔÚÓÚDesktop£¨×ÀÃ棩³ÌÐòÖеģ¬MÊÇÖ¸Êý¾ÝÄ£ÐÍ£¬VÊÇÖ¸Óû§½çÃ棬CÔòÊÇ¿ØÖÆÆ÷¡£Ê¹ÓÃMVCµÄÄ¿µÄÊǽ«MºÍVµÄʵÏÖ´úÂë·ÖÀë¡£MVCÊÇÒ»¸öÉè¼Æģʽ£¬ËüÇ¿ÖÆÐÔµÄʹӦÓóÌÐòµÄÊäÈ룬´¦ÀíºÍÊä³ö·Ö¿ª¡£Ê¹ÓÃMVCÓ¦ÓóÌÐò±»·ÖΪÈý¸öºËÐIJ¿¼þ£ºÄ£ÐÍ£¬ÊÔͼ£¬¿ØÖÆÆ÷¡£ËüÃǽ«´¦Àí×Ô¼ºµÄÈÎÎñ¡£
2.ΪʲôҪʹÓÃMVC?
Ê×Ï ......
½üÀ´Éè¼Æģʽ·çÐУ¬MVCËæ´¦¿É¼û£¬PHPÁìÓòÒ²²»ÀýÍ⣬ºÜ¶àÂÛ̳¶¼¿ªÊ¼ÌÖÂÛÔÚPHPÖÐʹÓÃMVC¡£È»¶ø£¬M¡¢V¡¢CÔÚPHPÖе½µ×¸ÃÈçºÎʵÏÖ£¿MVCÕæµÄÊʺÏPHPô£¿ÕâÀïEasy¸ø³öһЩ×Ô¼ºµÄ˼¿¼¡£
½üÀ´Éè¼Æģʽ·çÐУ¬MVCËæ´¦¿É¼û£¬PHPÁìÓòÒ²²»ÀýÍ⣬ºÜ¶àÂÛ̳¶¼¿ªÊ¼ÌÖÂÛÔÚPHPÖÐʹÓÃMVC¡£È»¶ø£¬M¡¢V¡¢CÔÚPHPÖе½µ×¸ÃÈçºÎʵÏÖ£¿MVCÕæµÄÊʺÏPHP ......
echo "<script language='javascript'>
alert('ͼÊéÐÅÏ¢Ìí¼Ó³É¹¦!');history.back();</script>";
¡¾ ×ÖÌ壺<A href="javascript:ContentSize(16)">´ó</A>
......
ÔÚjavascript´úÂëÖÐÓÃencodeURIComponent()º¯Êý´¦ÀíÖÐÎÄ×Ö·û´®£¬
JS´úÂ룺
<mce:script type=”text/javascript”><!--
string = encodeURIComponent(string);
location.href = index.php?keyword=’+string;
// --></mce:script>
PHP´úÂë:
<?php
$keyword = (isset($_GET ......