为什么这个页面在PHP5.3下不能正常的被执行? 就是访问后很慢,超级慢,状态栏一直显示该页面没有执行完..
我这个页面是以前在PHP5.2下做的, 再放到PHP5.3下运行就不成了..list.php
<?php
include("conn.php");
include("head.php");
?>
<html> <head>
<title></title>
</head> <body>
<table border="0" align="center" width="500" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?
$sql="select * from message order by id desc";
$query=mysql_query($sql,$conn);
while($row=mysql_fetch_array($query)){
?>
<tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?>
用户:<?=$row[user]?>
</td>
</tr>
<tr bgcolor="#ffffff">
<td>
内容:<?
//调用conn.php中的htmtocode函数,过滤替换文件内容
echo htmtocode($row[content]);
?>
</td>
</tr>
<?
}
?>
</table> </body>
</html>conn.php
<?php
$conn = @mysql_connect("127.0.0.1","note","123456") or die("数据库连接出错");
mysql_select_db("simplenote",$conn);
mysql_query("set names 'GBK'"); function htmtocode($content){
$content = str_replace("\n", "<br>", str_replace(" ", " ", $content));
return $content;
}
?>
head.php (这个页面是正常的,里面没有包含PHP代码)
<html> <head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head> <link href="images/css.css" rel="stylesheet" type="text/css">
<b>
<a href="add.php">添加留言</a> |
<a href="list.php">浏览留言</a> |
<a href="login.php">登陆</a>
</b>
<hr size="1"></html>
我这个页面是以前在PHP5.2下做的, 再放到PHP5.3下运行就不成了..list.php
<?php
include("conn.php");
include("head.php");
?>
<html> <head>
<title></title>
</head> <body>
<table border="0" align="center" width="500" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?
$sql="select * from message order by id desc";
$query=mysql_query($sql,$conn);
while($row=mysql_fetch_array($query)){
?>
<tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?>
用户:<?=$row[user]?>
</td>
</tr>
<tr bgcolor="#ffffff">
<td>
内容:<?
//调用conn.php中的htmtocode函数,过滤替换文件内容
echo htmtocode($row[content]);
?>
</td>
</tr>
<?
}
?>
</table> </body>
</html>conn.php
<?php
$conn = @mysql_connect("127.0.0.1","note","123456") or die("数据库连接出错");
mysql_select_db("simplenote",$conn);
mysql_query("set names 'GBK'"); function htmtocode($content){
$content = str_replace("\n", "<br>", str_replace(" ", " ", $content));
return $content;
}
?>
head.php (这个页面是正常的,里面没有包含PHP代码)
<html> <head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head> <link href="images/css.css" rel="stylesheet" type="text/css">
<b>
<a href="add.php">添加留言</a> |
<a href="list.php">浏览留言</a> |
<a href="login.php">登陆</a>
</b>
<hr size="1"></html>
2.看php5.3的php.ini配置中,mysql打开了吗
3.mysql_connect前面的@链接去掉,看有什么错误
4.是否mysql版本过低,链接不上,换一个mysql版本
//开启报错级别
error_reporting(E_ALL);
//error_reporting(7);
在页面最顶部加入这个,就知道错误原因了