php³õ¼¶½Ì³Ì(Ê®)ÐÂÎŵÄÁбíºÍɾ³ý
ÏÖÔÚÎÒÃÇ¿ªÊ¼½éÉÜÐÂÎŵÄÁбíºÍɾ³ýÁË¡£
н¨Á¢Ò»¸öÎļþlistnews.php,ÄÚÈÝÈçÏ£º
< ?php
require_once('../inc/config.php');
//°üº¬ÅäÖÃÎļþ
?>
<html>
<head></head>
<title>ÐÂÎŹÜÀí</title>
<body>
<div class="newstitle"></div>
<div class="newslist">
< ?php
//ÕâÀïÏÔʾÐÂÎÅÁбí
$page = $_GET['page'];
if( $page < 1) $page =1;
//»ñÈ¡µ±Ç°Ò³ÃæÊý
$per = 10;
//ÿҳÏÔʾÊýÁ¿
$begin = ($page - 1) * $per;
$pre = $page -1;
//ÉÏÒ»Ò³
$next = $page + 1;
//ÏÂÒ»Ò³
//·´ÕýËùÓеIJÙ×÷¶¼»áÓõ½mysqlÁ¬½Ó£¬ËùÒÔÎÒÃÇÏȽ¨Á¢Á¬½Ó
$conn = mysql_pconnect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS)
or die('Á¬½ÓÊý¾Ý¿âʧ°Ü');
mysql_select_db(DB_NAME);
$sql = "SELECT * from ".NEWS_BASE." WHERE 1 ORDER BY news_id limit ".$begin.",".$per;
$res = mysql_query($sql) or die(mysql_error());
//²éѯÊý¾Ý¿â
echo "<table border='1'><tr>";
echo "<td>ÐÂÎÅʱ¼ä</td><td>ÐÂÎűêÌâ</td>";
echo "<td>²Ù×÷</td></tr><tr>\n";
while( $obj = mysql_fetch_object($res)){
//Ñ»·È¡³öÊý¾Ý£¬¹ØÓÚmysqlµÄº¯ÊýÇë²Î¿¼phpÊÖ²á
//È»ºóÑ»·±í¸ñ
echo "</tr><tr>";
echo "<td>".$obj->news_date."</td>";
echo "<td>".$obj->news_title."</td>";
echo "<td><input type='button' onClick='mod(".$obj-/>news_id.")' value='ÐÞ¸Ä' />";
echo "<input type='button' value='ɾ³ý' onClick='del(".$obj-/>news_id.")' /></td>";
echo "</tr>";
//ÉÏÃæµÄ°´Å¥»á´¥·¢javascriptʼþ
//ËùÒÔÏÂÃæÎÒ½«Ë³±ãдһÏÂjs
//Èôó¼ÒÊìϤһÏÂ
}
echo "";
?>
<a href="?page=<?php echo $pre;?>">ÉÏÒ³</a>
<a href="?page=<?php echo $next;?>">ÏÂÒ³</a>
</div>
<script language="javascript">
function mod(id){
//Ð޸ĵĺ¯Êý
//ÎÒÃǽ«Õâ¸ö´øµ½editnews.php?id=idÉÏÈ¥
window.location = "editnews.php?id="+id+"&page=< ?php echo $page;?>";
}
function del(id){
//Ð޸ĵĺ
Ïà¹ØÎĵµ£º
1.Ò³ÃæÖ®¼äÎÞ·¨´«µÝ±äÁ¿
get,post,sessionÔÚ×îеÄphp°æ±¾ÖÐ×Ô¶¯È«¾Ö±äÁ¿Êǹرյģ¬ËùÒÔÒª´ÓÉÏÒ»Ò³ÃæÈ¡µÃÌá½»¹ýÀ´µÃ±äÁ¿ÒªÊ¹ÓÃ$_GET['foo'],$_POST['foo'],$_SESSION['foo']À´µÃµ½¡£µ±È»Ò²¿ÉÒÔÐÞ¸Ä×Ô¶¯È«¾Ö±äÁ¿Îª¿ª(php.ini¸ÄΪregister_globals = On)£»¿¼Âǵ½¼æÈÝÐÔ£¬»¹ÊÇÇ¿ÆÈ×Ô¼ºÊìϤеÄд·¨±È½ÏºÃ¡£
2.Win32 ......
PHPµÄÓŵãÊǼòµ¥ÊµÓá£ÓÃËüÀ´Ð´Ò»Ð©½Å±¾£¬»òÕßÊÇwebservice¡¢Êý¾Ý¿âÀàµÄһЩ·ÃÎÊ£¬È·ÊµÊǺܼòµ¥·½±ã¡£
µ«ËüÓÐÒ»¸öºÜ´óµÄÎÊÌ⣬¾ÍÊÇÄÚ´æµÄ»ØÊÕÎÊÌâ¡£¸ù¾ÝʹÓõľÑé¾õµÃÊǼ¸ºõÊÇûÓлØÊÕ¡£±ÈÈç½âÎöÒ»¸ö1°ÙÕ×µÄXMLÎļþ£¬ÄÚ´æʹÓÃÄܵ½1G¶à£¬¶øÇÒ»¹²»ÊÍ·Å¡£
ËùÒÔÓÃphpдºǫ́³ÌÐò£¬Ò»¶¨²»Òª×ö³ÉËÀÑ»·µÄ£¬ÖÁÉÙÊǹýÒ»¶Îʱ¼äÍ˳ö ......
Linux + Apache2.0 + Mysql + PHP + phpBB3.0
1.°²°ü£º
Apache2.0
#tar -zxf httpd-***.tar.gz -C /usr/local/src/
#cd /usr/local/src/httpd-***
  ......
×÷ΪʵÏÖ¶¯Ì¬ÍøÕ¾µÄ¹¤¾ßÖ®Ò»£¬PHPÒÔÆäÓï·¨¼òµ¥¡¢¸ßЧ¿ìËٺͶÔÊý¾Ý¿âµÄ¹ã·ºÖ§³Ö¶øÉîÊÜÓû§»¶Ó¡£±àдPHP³ÌÐòºÍASPÒ»ÑùÐèÒªÔÚ±¾»úµ÷ÊÔ£¬Îª´ËÐèÒªÅäÖÃһϵ÷ÊÔ»·¾³¡£
Óкܶ෽°¸¿ÉÒÔÑ¡Ôñ£¬ÕâÀïÌṩÁ½ÖÖ½ÏΪ¼òÒ׵ķ½·¨¡£
²»¹ÜÊÇÄÄÖÖ·½·¨£¬¶¼ÐèÒª°²×°PHP¡£Èç¹ûÄãÊÇPHPʹÓÃÕߣ¬Äã¿ÉÄÜÔÚÍøÉÏÕÒ¹ýPHPµÄ°²×°×ÊѶ£¬ËüÃǼ¸ºõ¶¼ËµµÄ ......
ÔÚPHPÖÐʹÓùýSESSIONµÄÅóÓÑ¿ÉÄÜ»áÅöµ½Õâôһ¸öÎÊÌ⣬ÔÚijЩ¿Í»§¶ËµçÄÔÉÏSESSION±äÁ¿²»ÄÜ¿çÒ³´«µÝ¡£ÕâÁîÎÒ¿àÄÕÁ˺ÃЩÈÕ×Ó£¬×îÖÕͨ¹ý²é×ÊÁÏ˼¿¼²¢½â¾öÁËÕâ¸öÎÊÌâ¡£ÎÒÈÏΪ£¬³öÏÖÕâ¸öÎÊÌâµÄÔÒòÓÐÒÔϼ¸µã£º
1¡¢¿Í»§¶Ë½ûÓÃÁËcookie
2¡¢ä¯ÀÀÆ÷³öÏÖÎÊÌ⣬ÔÝʱÎÞ·¨´æÈ¡cookie
3¡¢php.iniÖеÄsession.use_trans_sid = 0»òÕß±àÒë ......