Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PHPÖ®Socket±à³Ì


±¾ÆªÎÄÕÂÀ´Ô´ÓÚ ºÚ¿Í»ùµØ-È«Çò×î´óµÄÖÐÎĺڿÍÕ¾ Ô­ÎÄÁ´½Ó£ºhttp://hackbase.com/tech/2009-08-04/54550_1.html
2007Äê11ÔÂ01ÈÕ ÐÇÆÚËÄ ÏÂÎç 03:48ÈÃÎÒÃÇÒÔÒ»¸ö¼òµ¥µÄÀý×Ó¿ªÊ¼---Ò»¸ö½ÓÊÕÊäÈë×Ö·û´®,´¦Àí²¢·µ»ØÕâ¸ö×Ö·û´®µ½¿Í»§¶ËµÄTCP·þÎñ.ÏÂÃæÊÇÏàÓ¦µÄ´úÂë:PHP ´úÂë: ------------------------------------------------- ...
2007Äê11ÔÂ01ÈÕ ÐÇÆÚËÄ ÏÂÎç 03:48ÈÃÎÒÃÇÒÔÒ»¸ö¼òµ¥µÄÀý×Ó¿ªÊ¼---Ò»¸ö½ÓÊÕÊäÈë×Ö·û´®,´¦Àí²¢·µ»ØÕâ¸ö×Ö·û´®µ½¿Í»§¶ËµÄTCP·þÎñ.ÏÂÃæÊÇÏàÓ¦µÄ´úÂë:
PHP ´úÂë:
--------------------------------------------------------------------------------
<?
// ÉèÖÃһЩ»ù±¾µÄ±äÁ¿
$host = "192.168.1.99";
$port = 1234;
// ÉèÖó¬Ê±Ê±¼ä
set_time_limit(0);
// ´´½¨Ò»¸öSocket
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create
socket\n");
//°ó¶¨Socketµ½¶Ë¿Ú
$result = socket_bind($socket, $host, $port) or die("Could not bind to
socket\n");
// ¿ªÊ¼¼àÌýÁ´½Ó
$result = socket_listen($socket, 3) or die("Could not set up socket
listener\n");
// accept incoming connections
// ÁíÒ»¸öSocketÀ´´¦ÀíͨÐÅ
$spawn = socket_accept($socket) or die("Could not accept incoming
connection\n");
// »ñµÃ¿Í»§¶ËµÄÊäÈë
$input = socket_read($spawn, 1024) or die("Could not read input\n");
// Çå¿ÕÊäÈë×Ö·û´®
$input = trim($input);//½«ÊäÈë½á¹ûдÈëok.php£¬Õâ¾äÊÇÎÒ¼ÓµÄ
fputs(fopen('ok.php','a+'),"$input");
//´¦Àí¿Í»§¶ËÊäÈë²¢·µ»Ø½á¹û
$output = strrev($input) . "\n";
socket_write($spawn, $output, strlen ($output)) or die("Could not write
output\n");
// ¹Ø±Õsockets
socket_close($spawn);
socket_close($socket);
?>
--------------------------------------------------------------------------------
ÏÂÃæÊÇÆäÿһ²½ÖèµÄÏêϸ˵Ã÷:
1.µÚÒ»²½Êǽ¨Á¢Á½¸ö±äÁ¿À´±£´æSocketÔËÐеķþÎñÆ÷µÄIPµØÖ·ºÍ¶Ë¿Ú.Äã¿ÉÒÔÉèÖÃΪÄã×Ô¼ºµÄ·þÎñÆ÷ºÍ¶Ë¿Ú(Õâ¸ö¶Ë¿Ú¿ÉÒÔÊÇ1µ½65535Ö®¼äµÄÊý×Ö),Ç°ÌáÊÇÕâ¸ö¶Ë¿Úδ±»Ê¹ÓÃ.
PHP ´úÂë:
--------------------------------------------------------------------------------
<?
// ÉèÖÃÁ½¸ö±äÁ¿
$host = "192.168.1.99";
$port = 1234;
?>
-----------


Ïà¹ØÎĵµ£º

PHPÍøÂç±à³ÌÄã×¼±¸ºÃÁËÂð£¿

      ´óÈýÏÂѧÆÚ£¬ÎÒ½Ó´¥µ½ÁËPHP£¬Ñ§ÁËÒ»µã»ù±¾µÄÓï·¨£¬ÒòΪ¸úCµÄÓï·¨ºÜÏñ£¬ËùÒÔѧÆðÀ´ºÜÊ¡Á¦¡£½¥½¥µØÎÒϲ»¶ÉÏÁËPHPÕâÃÅÓïÑÔ£¬ÒòΪÓÃËü¿ÉÒÔ×öÍøÕ¾£¬µ½ÁË´óËÄÎÒ±ã¸ü¼ÓÉîÈëµØѧPHPÁË£¬Ñ§Ï°ÓÃPHP×ö¶«Î÷³ÉÁËÎÒÉú»îÖеÄÒ»²¿·Ö...............
       PHPÊÇÔËÐÐÓÚ·þÎñÆ ......

phpÒ³Ãæ¼ä´«Öµ

ÀýÈ磺
A.php
<?php
$usernane
?>
Òª½«A.phpÖصÄ$usernaneÖµ´«¸øÁíÍâÒ»¸öÒ³Ã棨B.php£©ÖеÄʵÏÖ·½·¨£º
<meta   http-equiv='refresh'   content='0;url='B.php£¿user=$username'>   
  ½ÓÊÕ   
  echo   $_GET['user'];
ÕâÑù£¬¾Í¿ÉÒÔÔÚB.phpÖзÃÎÊ$use ......

phpÖÐempty()£¬is_null()£¬isset()£¬boolÖ®¼äµÄÇø±ð


´ÓÕâ¸öͼÖУ¬¿ÉÒÔºÜÇå³þµÄ¿´µ½Ò»ÖÖÁªÏµ£º
¼ÙÉè $var ÊÇÈκÎtype¡£
µ± empty($var) Ϊ true ʱ£¬ (bool)($var) Ϊ false ¡£·´Ö®ÒàÈ»¡£
ͬÑù£¬
µ± is_null($var) Ϊ true ʱ£¬ isset($var) Ϊ false ¡£·´Ö®ÒàÈ»¡£
¼ÙÈç:
$i=$j+1;
ÕâÀïµÄis_null($j)Ϊtrue
¿É¼û£º
issetÓÃÓÚÅжÏ䶨ÒåµÄÇé¿ö¡£
Empty¿ÉÒÔÅжÏδ¶¨Ò ......

ÔÚIIS 5.1 »òIIS6 ÖÐÅäÖÃPHP µÄFastCGIģʽ


ÔÚIIS 5.1 »òIIS6 ÖÐÅäÖÃPHP µÄFastCGIģʽ
Ò»¡¢FastCGIÊÇʲô£¿
¡¡¡¡FastCGIÊÇÓïÑÔÎ޹صġ¢¿ÉÉìËõ¼Ü¹¹µÄCGI¿ª·ÅÀ©Õ¹£¬ÆäÖ÷ÒªÐÐΪÊǽ«CGI½âÊÍÆ÷½ø³Ì±£³ÖÔÚÄÚ´æÖв¢Òò´Ë»ñµÃ½Ï¸ßµÄÐÔÄÜ¡£ÖÚ
ËùÖÜÖª£¬CGI½âÊÍÆ÷µÄ·´¸´¼ÓÔØÊÇCGIÐÔÄܵÍϵÄÖ÷ÒªÔ­Òò£¬Èç¹ûCGI½âÊÍÆ÷±£³ÖÔÚÄÚ´æÖв¢½ÓÊÜFastCGI½ø³Ì¹ÜÀíÆ÷µ÷¶È£¬Ôò¿ÉÒÔÌṩÁ¼ºÃ ......

php±à³Ì£¬Õë¶ÔMYSQLµÄ²Ù×÷Àà

<?php
/*
*PHP¹ÜÀíMYSQLµÄÊý¾Ý¿âÀà
ʹÓ÷½·¨£º$dbConn = new DbConn([$Êý¾Ý¿âÃû(¿ÉÑ¡)]);
ÔÊÐí·µ»ØµÄ·½·¨£º
Execute($sql) //Ö´ÐÐSQLÓï¾ä£¬Ã»Óзµ»ØÖµ;
getRs($sql) //·µ»Ø²éѯÓï¾äµÄ¼Ç¼£¬Ò»Ìõ;
getRsArray($sql) //·µ» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ