ÓÃÄ£°å¼¼ÊõʵÏÖPHP´úÂëºÍHMTL´úÂë·ÖÀë
1¡¢Ä£°åµÄÓÉÀ´
ÔÚûÓÐÄ£°å¼¼Êõ֮ǰ£¬Ê¹ÓÃPHP¿ª·¢³ÌÐò£¬Í¨³£¶¼ÊÇphp´úÂëºÍhtml»ì±àÔÚÒ»Æð¡£±ÈÈç˵ÐÂÎÅÁÐ±í£¬ºÜ¿ÉÄܾÍÊÇÒ»¸önewslist.phpÒ³Ã棬½á¹¹ÈçÏ£º
<?
//´ÓÊý¾Ý¿âÖжÁÈ¡³öÒªÏÔʾµÄÐÂÎżÇ¼
?>
<html>
<head>……..
</head>
<body>
<?
While ($news = mysql_fetch_array($result)) {
?>
<!--Êä³öÐÂÎűêÌâ -- >
<?
}
?>
</body>
</html>
ÄÇôÕâÑùÓÐʲôÎÊÌâÄØ£¿Ê×ÏÈ£¬²»ÀûÓÚ·Ö¹¤ºÏ×÷¡£Ò»°ãÀ´Ëµ£¬¶¼»áÓɳÌÐòÔ±À´Ð´´úÂ룬ÃÀ¹¤ÈËÔ±Éè¼ÆÒ³Ãæ¡£ÄÇôÔÚÕâÖÖ·½Ê½ÖУ¬³ÌÐòÔ±±ØÐëµÈ´ýÃÀ¹¤ÈËÔ±°Ñ½çÃæÉè¼ÆºÃ²ÅÄÜ¿ªÊ¼¹¤×÷¡£Ò²¾ÍÊÇ˵³ÌÐòÔ±ºÍÃÀ¹¤µÄ¹¤×÷ÊDz»ÄÜͬ²½µÄ¡£Æä´Î¡¢²»ÀûÓÚά»¤£¬¿Éά»¤ÐԲ±ÈÈç˵³ÌÐò¹Ì¶¨ºó£¬ÒªÐ޸ĽçÃ棬ÄÇô±ØÐëÓÉÃÀ¹¤Ð޸ĺ󣬳ÌÐòÔ±ÔÙÖØÐÂÌí¼Ó¡£×îºó£¬³ÌÐò½á¹¹»ìÂÒ£¬¿É¶ÁÐԲHTMLºÍPHP»ì±àÔÚÒ»Æð£¬Ò»µ©³ÌÐòÒ»¶à£¬¾Í»á±äµÄ·Ç³£µÄÁèÂÒ¡£
Àí½âÄ£°åÔÀ헗ʹÓÃPHP±êÇ©µÄÄ£°å¼¼Êõ
Ä£°å¼¼ÊõÕýÊÇΪÁ˽â¾öÕâЩÎÊÌâ¶ø³öÏֵģ¬ÎªÁ˽â¾öÕâЩÎÊÌ⣬×îÔç³öÏÖµÄÊÇʹÓÃphp±êÇ©µÄÄ£°å¼¼Êõ¡£
Ê×ÏÈ£¬ÎÒÃÇÒªÃ÷°×Ä£°åµÄÄ¿µÄÊÇʲô¡£Ä£°åÖ÷ҪҪʵÏÖ¼¸¸öÈÎÎñÄØ£¿µÚÒ»¡¢ÃÀ¹¤ºÍ³ÌÐòµÄ·ÖÀë¡£¸üÈ·ÇеÄ˵·¨ÊÇ»ñÈ¡Êý¾ÝºÍÏÔʾÊý¾ÝµÄ·ÖÀë¡£µÚ¶þ¡¢·Ö¹¤¡£Á¼ºÃµÄ·Ö¹¤ºÏ×÷¡£
±ÈÈç˵ÐÂÎÅÁÐ±í£¬Èç¹ûʹÓÃÄ£°å£¬ÎÒÃǾͿÉÒÔ°ÑÐÂÎÅÁбíµÄ²Ù×÷·Ö³ÉÁ½²¿·Ö£º
1¡¢ getnews.php ¸ºÔð´ÓÊý¾Ý¿âÖжÁÈ¡Êý¾Ýµ½Êý×é$newsÖУ¬²»¹ØÐÄ$newsÊÇÈçºÎÏÔʾµÄ¡£
2¡¢ Shownews.php ¸ºÔð°Ñ$newsÊý×éÊä³ö³ÉHTMLÒ³Ãæ¡£¶øËü²»ÐèÒªÀí»á$newsÊÇ´ÓÄÄÀïÀ´µÄ¡£
ºÃ£¬ÕâÑù£¬ÎÒÃǾÍʵÏÖÁËÃÀ¹¤ºÍ³ÌÐòµÄ·ÖÀ룬´ïµ½ÁËÎÒÃǵijõ²½Ä¿µÄ£¬µ«ÊÇÈçºÎ°ÑÕâÁ½¸öÒ³ÃæÁªºÏÆðÀ´£¬²¢ÊµÏÖlistnews.phpµÄ¹¦ÄÜÄØ£¿
Õâ¾ÍÐèÒªÁíÍâÒ»¸öÒ³Ãælistnews.php£¬À´¸ºÔð°Ñ“ÃÀ¹¤£¨ÏÔʾÊý¾Ý£©”ºÍ“³ÌÐòÔ±£¨»ñÈ¡Êý¾Ý£©”Á¬½ÓÆðÀ´¡£Ó¦¸Ã˵Õâ¸öÒ³Ãæ¾ÍÊǺܼòµ¥ÁË¡£
¼ÙÉègetnews.phpµÄ´úÂëÈçÏ£º
<?
$news =“ÐÂÎÅÁбí”;//ʵ¼ÊÖÐÓ¦¸ÃÊÇ´ÓÊý¾Ý¿âÖжÁÈ¡³öÀ´µÄ¡£
?>
Shownesw.phpµÄ´úÂëÈçÏ£º
<html>
<head>
<title>ÏÔʾÐÂÎÅ</title>
</head>
<body>
<?=$news?>
</body>
</html>
ÄÇô£¬Õâ¸öÁªºÏÒ³Ãælistnews.phpµÄ´úÂë¾ÍºÜ¼òµ¥ÁË
<?
Include(‘getnews.php');//»ñÈ
Ïà¹ØÎĵµ£º
PHPnow ÊÇʲô?
Win32 ÏÂÂÌÉ«Ãâ·ÑµÄ Apache + PHP + MySQL »·¾³Ì×¼þ°ü¡£
¼òÒ×°²×°¡¢¿ìËٴ֧³ÖÐéÄâÖ÷»úµÄ PHP »·¾³¡£¸½´ø PnCp.cmd ¿ØÖÆÃæ°å£¬°ïÖúÄã¿ìËÙÅäÖÃÄãµÄÌ×¼þ£¬Ê¹Ó÷dz£·½±ã¡£
PHPnow ÊÇÂÌÉ«µÄ£¬½âѹºóÖ´ÐÐ Init.cmd ³õʼ»¯£¬¼´¿ÉµÃµ½Ò»¸ö PHP + MySQL »·¾³¡£
È»ºó¾Í¿ÉÒÔÖ±½Ó°²×° Discuz!, PHPWind, ......
Ò»¡¢Ç°Ìá
ÎÒÃÇÐèÒªÒ»¸ö Web ·þÎñÆ÷À´½âÎöÓà PHP ´´½¨µÄÒ³Ãæ²¢°ÑËüÃÇÏÔʾµ½ä¯ÀÀÆ÷¡£±¾ÎÄÖÐʹÓõÄÊÇ Apache2¡£µ«ÊÇ£¬ÈκΠWeb ·þÎñÆ÷¶¼¿ÉÒÔÂú×ãÒªÇó¡£
ÒªÀûÓñ¾ÎÄÖнéÉܵÄһЩµ÷ÊÔ¼¼Êõ£¬ÐèÒª°²×° Eclipse V3.1.1 ºÍ²å¼þ PHPEclipse V ......
ÎļþËøÓÐÁ½ÖÖ£º¹²ÏíËøºÍÅÅËûËø£¬Ò²¾ÍÊǶÁËø(LOCK_SH)ºÍдËø(LOCK_EX)
ÎļþµÄËøÒ»°ãÕâôʹÓãº
$fp = fopen("filename", "a");
flock($fp, LOCK_SH) or die("lock error")
$str = fread($fp, 1024);
flock($fp, LOCK ......
·â×°Ò»¸öfunction£¬ÒԱ㸴Óá£
Ö§³Öhttps£¬»òÕßhttpµÄget»òÕßpost¡£
function httpURLfeedback($url,$request_type,$time_out = "60") {
$arr = parse_url($url);
$transports = "";
$port = 0;
$host = $arr['host'];
$query = $arr['query'];
$path = $arr['path'];
if($urlarr["scheme"] ......
Èí¼þÏÂÔصØÖ·£º
pcre£ºhttp://www.pcre.org/
Nginx£ºhttp://nginx.net/
spawn-fcig: http://redmine.lighttpd.net/projects/spawn-fcgi/news
ÀûÓà wget ÃüÁîÏÂÔØÏàÓ¦µÄ °²×°°ü
²½Öè
1¡¢°²×°pcre
ngnix ÐèÒª°²×°pcre¿â£º
wget http://sourceforge.net ......