获取discuz论坛讨论标题
/****
数据库:bbs
数据表:bbs_forum_post
连接数据库: $conn=mysql_connect('localhost','root','',true);
标题列表页:app_index.php
标题展示页:app_show.php
***/
/* app_index.php 如下代码 */
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>标题列表页</title>
</head>
<body>
<?php
$conn=mysql_connect('localhost','root','',true);
mysql_select_db("bbs",$conn);
mysql_query("set names 'utf8'",$conn);
$result = mysql_query("SELECT * FROM bbs_forum_post where subject!='' order by pid desc");
while($row = mysql_fetch_array($result))
{
echo "<a href='app_show.php?fid=".$row['fid']."&tid=".$row['tid']."'>".$row['subject']."</a></br>";
}
mysql_close($conn);
?>
</body>
</html>
/* app_show.php 如下代码 */
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>标题展示页</title>
</head>
<body>
<?php
$conn=mysql_connect('localhost','root','',true);
mysql_select_db("bbs",$conn);
mysql_query("set names 'utf8'",$conn);
$result = mysql_query("SELECT * FROM bbs_forum_post where first='1' and fid='". $_GET['fid']."' and tid='". $_GET['tid']."' ");
while($row = mysql_fetch_array($result))
{
echo $row['subject']."</br>";
}
mysql_close($conn);
?>
<?php
$conn=mysql_connect('localhost','root','',true);
mysql_select_db("bbs",$conn);
mysql_query("set names 'utf8'",$conn);
$result = mysql_query("SELECT * FROM bbs_forum_post where first='1' and fid='". $_GET['fid']."' and tid='". $_GET['tid']."' ");
while($row = mysql_fetch_array($result))
{
$str=$row['message'];
echo preg_replace("/\[.*\]/",'',$str);
}
mysql_close($conn);
?>
</body>
</html>