ÍøÕ¾½¨ÉèÖÐÀûÓÃPHP×Ô¶¯Ö´ÐÐÈÎÎñ´úÂë×Ô¶¯Éú³É¾²Ì¬Ò³Ãæ
À´Ô´: ÐÂÔƿƼ¼ http://www.kz27.com/site/php-zidong-chengxu/
ÁªÏµÎÒÃÇ
ÍøÕ¾½¨ÉèÖÐÀûÓÃPHP×Ô¶¯Ö´ÐÐÈÎÎñ´úÂëÊǺÜÓÐÓõģ¬ÈçÈóÌÐò¶¨ÆÚ×Ô¶¯Éú³É¾²Ì¬Ò³ÃæµÈ¡£Èç¹ûÄúÊÇPHP³ÌÐòÔ±£¬Ñ§Ï°Javascript¡¢Ajax¡¢DIV+CSS¡¢ÕâЩ¶¼ÊǺÜÓбØÒªµÄ¡£
1.ÔÚij¸ö¹Ì¶¨µÄʱ¼äÖ´ÐеÄPHP´úÂ룺
//¼Æ»®Ö´ÐÐʱ¼ä
if($job=="cron"){
check_method();
//²éѯÊý¾Ý¿âµÄÏÂÒ»¸öʱ¼äÊÇ·ñСÓÚÏÖÔÚµÄʱ¼ä
if($maxrecord["deltemptime"]<$nowtime["timestamp"]){
$crondb = array();
//dayΪ0ΪÿÈÕ weekÖÜ minuteʱ¼ä¶Ï hourʲôʱºî¿ªÊ¼
$rt["cron"] = array("day"=>"0","week"=>$config["cron_week"],"m"=>$config["cron_minute"],"hour"=>$config["cron_hour"]);
$crondb[] = $rt;
}
foreach ($crondb AS $key => $cron_val){
//ÉèÖÃÁËÔÊÐí·ÖÖÓ¶Î
if (!empty($config["cron_minute"])){
$m = explode(" ", $config["cron_minute"]);
$m_now = intval(local_date("i",$nowtime["timestamp"]));
if (!in_array($m_now, $m)) {//²»°üº¬´Ë·ÖÖÓµÄÌø³ö
continue;
}
}
$next_time = get_next_time($cron_val["cron"]);
$DB->query("UPDATE `maxrec` SET `deltemptime`={$next_time}");
}
exit;
}
>
2.¸ôʱÉú³ÉÊ×Ò³µÄPHP´úÂ룺
set_time_limit(0);
$baseCmsUrl = "http://www.kz27.com";//ÄãÍøÕ¾µÄ¸ùÍøÖ·£¬½áÊø²»Òª¼Ó /
$dmPageName = "index.php";//¶¯Ì¬Ö÷Ò³µÄÃû³Æ
$stPageName = "index.html";//Éú³É¾²Ì¬Ö÷Ò³µÄÃû³Æ
$mkTime = 3600;//ÄãÏ£Íû¶à³¤Ê±¼ä¸üÐÂÒ»´Î£¬µ¥Î»ÊÇÃë
//ÏÂÃæÊÇÖ´ÐеĴúÂë
$tureStFile = dirname(__FILE__)."/".$stPageName;
$ftime = @filemtime($tureStFile);
if(!file_exists($tureStFile) || ($ftime < time()-$mkTime))
{
$body = file_get_contents($baseCmsUrl."/".$dmPageName);
$fp = fopen($tureStFile, "w");
fwrite($fp, $body);
fclose($fp);
}
>
½«ÉÏÃæ´úÂë±£´æΪtask.php
ÔÚ¾³£·ÃÎʵÄÒ³Ãæµ÷Óãº
ÉîÛÚÓ¢ÎÄÍâóÍøÕ¾½¨ÉèÓ¦¸Ã±ÜÃâµÄ5¸öÎóÇø
ÈçºÎÈÿͻ§ÐÅÈÎÆóÒµµÄÍøÕ¾
µ½µ×ʲôÊÇÍøÂçÓªÏú£¬ÆóÒµºÍ¸öÈËÈçºÎ×öÍøÂçÓªÏú
ÉîÛÚÍøÕ¾ÓÅ»¯Ö®Í¼Æ¬ALT±êÇ©µÄÓ¦ÓÃ
ÉîÛÚÍøÕ¾Éè¼Æ£ºÈçºÎ×öµ½¼òÔ¼¶ø²»¼òµ¥
רҵÍøÕ¾½¨Éè±Ø²»¿ÉÉÙµÄÖØÍøÕ¾»·½Ú-ÍøÕ¾²ß»®
3.PHP×Ô¶¯Ö´ÐÐÈÎÎñ£¬¹ØµôÒ³Ãæ»òä¯ÀÀÆ÷Ò²»á×Ô¶¯¶¨Ê±Ö´ÐУº
ignore_user_abort(); //¼´Ê¹Client¶Ï¿ª(Èç¹Øµôä¯ÀÀÆ÷)£¬PHP½Å±¾Ò²¿É
Ïà¹ØÎĵµ£º
¿Í»§¶ËIPÏà¹ØµÄ±äÁ¿
1. $_SERVER['REMOTE_ADDR']; ¿Í»§¶ËIP£¬ÓпÉÄÜÊÇÓû§µÄIP£¬Ò²ÓпÉÄÜÊÇ´úÀíµÄIP¡£
2. $_SERVER['HTTP_CLIENT_IP']; ´úÀí¶ËµÄIP£¬¿ÉÄÜ´æÔÚ£¬¿ÉαÔì¡£
3. $_SERVER['HTTP_X_FORWARDED_FOR']; Óû§ÊÇÔÚÄĸöIPʹÓõĴúÀí£¬¿ÉÄÜ´æÔÚ£¬¿ÉÒÔαÔì¡£
·þÎñÆ÷¶ËIPÏà¹ØµÄ±äÁ¿
1. $SERVER_NAME£¬ÐèҪʹÓú¯Êýget ......
ÔÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/2010/01/28/1-4/
Ç°ÎĽéÉÜÁËPHPµÄÓïÑÔ¹¹³ÉÓ빤×÷ÔÀí£¬½ÓÏÂÀ´Õýʽ½éÈëPHPµÄÓï·¨¡£
ÔÚPHPÖУ¬»ù±¾Êý¾Ý¿É·ÖΪ³£Á¿ºÍ±äÁ¿Á½ÖÖ¡£¶øphpµÄ³£Á¿ºÍ±äÁ¿Ãûͨ³£³ÆΪ±êʶ·û¡£
ÐèҪעÒâµÄÊDZêʶ·û±ØÐëÒÔ×Öĸ»òÕßÏ»®Ïß¿ªÍ·£¬²¢ÇÒÖ»ÄÜ°üÀ¨×Öĸ¡¢Êý×ÖºÍÏ»®Ïß¡£
³£Á¿µÄ ......
ÔõôÑùµÄÐéÄâÖ÷»úËãÊǺõÄÖ÷»úÄØ£¿Ò»°ãÀ´Ëµ£¬´ó¼Ò¹ºÂòµÄÐéÄâÖ÷»ú¶¼ÊÇasp ..net »òÕßphpµÄ¡£javaÐéÄâÖ÷»úÒ»°ã±È½ÏÉÙ¡£ÕâºÍjavaÐéÄâÖ÷»úµÄά»¤ÄѶȺͳɱ¾½Ï¸ßÓйء£¶øÇÒjava¶ÔÓÚÍøÕ¾ÓµÓÐÕߵļ¼ÊõÒªÇóÒ²¸ßÓÚaspºÍphp¡£ Ò»°ãÀ´Ëµ£¬Ðí¶ ......
ÉÏ´Îдµ½asp£¬php¿Õ¼äÓйØÊý¾Ý¿âÑ¡ÔñµÄÎÊÌâ¡£¶ÔÓÚÊý¾Ý¿âµÄ´îÅä Ò»°ãÊÇÕâÑù asp+access/ asp+sql server,È»ºóÊÇphp+mysql¡£accessÊÇ¿ÉÒÔºÍÍøÒ³¿Õ¼ä¹²Ïí´óСµÄ£¬¶øsql server ºÍmysqlÊÇÒªµ¥¶À¹ºÂòµÄ¡£¶ÔÓÚÒ»°ãµÄСӦÓã¬ÓÃasp+access¾Í¿ÉÒԸ㶨ÁË¡£»òÕßÊÇ.net+access¡£ ÕâЩ ¼¸ºõ¾Í²»Òª¿¼ÂÇÊý¾Ý¿â³É±¾ÁË¡£µ«ÊÇʹÓÃphpµÄ»°£¬¾Í ......
µÚ1Õ LAMPÍøÕ¾¹¹½¨ 1
1.1 ÍøÕ¾Èí¼þ¼ò½é.... 1
1.1.1 B/SÈí¼þÌåϵ½á¹¹... 1
1.1.2 ¶¯Ì¬ÍøÕ¾½éÉÜ... 2
1.2 ¶¯Ì¬ÍøÕ¾Èí¼þ¿ª·¢ËùÐèµÄWeb¹¹¼þ.... 3
1.2.1 ¿Í»§¶Ëä¯ÀÀÆ÷... 4
1.2.2 À©Õ¹³¬Îı¾±ê¼ÇÓïÑÔXHTML. 5
1.2.3 ²ãµþÑùʽ±íCSS. 6
1.2.4 ......