PHP ¶ÁдÎļþʾÀý
¡¡¡¡PHP ÖУ¬Êý¾Ýͨ³£¶¼ÊÇ´æ´¢ÔÚMySQLÊý¾Ý¿âµ±Öеġ£µ«ÊÇÓÐЩʱºò£¬ÎÒÃÇ»¹ÊÇÐèҪʹÓÃPHP¶ÁдһЩ±¾µØÎļþ¡£±ÈÈçÉú³É¾²Ì¬Ò³Ãæ»òÕßÊý¾ÝµÄ±¾µØ»º´æ¡£
¡¡¡¡ÎÒÃÇÓÃÒ»¸ö¼òµ¥µÄ·ÃÎÊÈÕÖ¾À´ÑÝʾһÏÂfopen, fread, fwrite, fcloseµÄÓ÷¨¡£
¡¡¡¡Ã¿µ±ÎÒÃÇ·ÃÎÊ´ËÍøÒ³µÄʱºò£¬»áÏÔʾ³ö·ÃÎʹýµÄIPÒÔ¼°·ÃÎÊʱ¼ä£»Í¬Ê±µ±Ç°µÄ·ÃÎÊÒ²»á±»¼Ç¼£¬ÒÔ±ãÔÚÏ´ηÃÎʵÄʱºò³öÏÖ¡£
<?php
header("Content-Type: text/plain");
$visitorIP = $_SERVER["REMOTE_ADDR"];
$currentTime = date("H:i:s");
if( file_exists("./visitLog.log") ):
$logFileHandle = fopen("./visitLog.log", "r+");
$logFileSize = filesize("./visitLog.log");
$logContent = fread($logFileHandle, $logFileSize);
else:
$logFileHandle = fopen("./visitLog.log", "x+");
$logContent = "\r\tNo more Log";
endif;
echo "Visit Log:" . $logContent;
fwrite($logFileHandle, "\r\t" . $visitorIP . "\t" . $currentTime);
fclose($logFileHandle);
?>
Ê×ÏÈÎÒÃÇÐèҪʹÓà file_exists(filename) º¯ÊýÀ´ÅжÏÈÕÖ¾ÎļþÊÇ·ñ´æÔÚ£¬Èç¹û²»´æÔÚÔò´´½¨£»
ËæºóÈç¹û´æÔÚ£¬ÎÒÃÇÖ±½Ó¶ÁÈ¡ÆäËùÓÐÄÚÈÝ£¬Óà fread(fileHandle, sizeToRead) À´¶ÁÈ¡£¨Èç¹ûÐèÒª¶ÁÈ¡ËùÓеÄÄÚÈÝ£¬sizeToRead ¿ÉÒÔÖ±½ÓÌîдÎļþµÄ´óС£©£»
¶ÁÈ¡ÍêÖ®ºó£¬ÎÒÃÇÔÚÓà fwrite(fileHandle, contentToWrite) À´Ð´ÈçеķÃÎʼǼ£»
µ±ËùÓеÄÎļþ²Ù×÷¶¼Íê³Éºó£¬ÎÒÃÇÓà fclose(fileHandle) À´¹Ø±ÕÒÑ´ò¿ªµÄÈÕÖ¾Îļþ¡£
¡¡¡¡ËùÓвÙ×÷Íê³É£¡
Ïà¹ØÎĵµ£º
//calendar.php
<?¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
/*******************************¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡*¡¡ ÓÃÀ´ÅжÏÊÇ·ñÈòÄêµÄº¯Êý¡¡¡¡*¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡*¡¡ ¿ÉÒÔ¸ù¾Ý¸ü¸´ÔÓµÄËã·¨¸Ä½ø¡¡*¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ......
ip_contrl.php:
<?php
//include('header.php');
$ipaddr = $_POST['ipaddr'];
$netmask = $_POST['netmask'];
$gateway = $_POST['gateway'];
$mac = $_POST['mac'];
$dns1 = $_POST['dns1'];
$dns2 = $_POST['dns2'];
//echo "ipaddr=$ipaddr;netm ......
Ò»£¬PHP½Å±¾´úÂë±ê¼Ç
PHPµÄ½Å±¾ÊÇÎļþÖÐÒ»¶ÔÌØÊâ±ê¼ÇËù°üÀ¨µÄÄÚÈÝ£¬ÈçASPÊÇ“<%....%>”,PHP¿É¿´³ÉÊÇ“<?...?>”¡£
È»¶øΪÁËÊÊÓ¦XML±ê×¼ÒÔ½«PHPǶÈëµ½XML»òXHTMLÖУ¬PHP²»½¨ÒéʹÓö̸ñʽµÄ“<?...?>”£¬¶ø½¨ÒéʹÓó¤¸ñʽ±ê¼Ç“<?php...?>”
´ËÍâPHP´úÂ ......
¿ªÔ´½¨Õ¾³ÌÐòÈñà³Ì¸ßÊÖºÍÖ»¶®´ò×ÖÉÏÍøµÄÈ˶¼¿ÉÒÔ¿ìËÙ½¨Á¢Ò»¸ö¹¦ÄÜÇ¿´ó¡¢½çÃæƯÁÁµÄÍøÕ¾¡£²»¹ÜÄãÊÇÏ뽨һ¸ö²©¿Í¡¢ÂÛ̳¡¢CMS¡¢µç×ÓÉÌÎñÍøÕ¾£¬»òÊÇWiki¡¢Ïà²á¹ÜÀí¡¢RSS¾ÛºÏºÍÀàDiggÍøÕ¾¡£Ä㶼¿ÉÒÔͨ¹ýÕâЩ½¨Õ¾¹¤¾ß¿ìËÙ½¨Á¢¡£
ÎÒÃÇ֮ǰ½éÉܹý23¸ö¿ªÔ´µÄCMS¹ÜÀíϵͳ£¬ÏÖÔÚÔòÈÃÎÒÃÇÀ´¿´Ò»ÏÂ26¿î¿ªÔ´½¨Õ¾³ÌÐò¡£
¹úÍâPHP¿ªÔ´½¨ ......
¡¡¡¡PHPÖеıäÁ¿Ò²ÓзÃÎÊÓò¡£×÷ÓÃÓò¿ÉÒÔʹÓÃPHPÖÐglobal
¡¡¡¡ÔÚº¯ÊýÄÚ²¿¡¢¶ÔÏóÖкÍÀàÖж¨ÒåµÄ¾Ö²¿±äÁ¿ÔÚº¯ÊýÍⲿÊÇÎÞ·¨±»·ÃÎʵ½µÄ£»Í¬Àí£¬ÔÚº¯ÊýÍⲿ¡¢¶ÔÏóÍâºÍÀàÍⶨÒåµÄ±äÁ¿£¬Èç¹ûûÓб»´«È룬ҲÊÇÎÞ·¨±»·ÃÎʵ½µÄ¡£
¡¡¡¡µ«ÊÇÈç¹ûÒ»¸öºÜ¶à±äÁ¿ÒªÍ¬Ê±±»´«ÈëºÜ¶àº¯Êý¡¢¶ÔÏó»òÕßÀ࣬ÎÒÃÇÒ²¿ÉÒÔÖ±½Ó½«ÆäÈ«¾Ö»¯¡£ÕâÑù²»½ö¿ÉÒÔ ......