<?php
echo "<html>";
echo "<head>";
echo "<title>";
echo "Reply Page";
echo "</title>";
echo "</head>";
echo "<body>";
echo "<center>";
echo "<font size=5>";
echo "Leave a Reply";
echo "</font>";
echo "<p>";
$file="data.txt";
$msg=file($file);
$msg_count=count($msg);
echo "当前共有留言.".$msg_count>.".条";
echo "<p>";
echo "<a href="submit.php">添加新留言</a>";
echo "<p>";
if($msg_count==0)
echo "没有留言..";
else
{
echo "<table border="1" bordercolor="blue">";
echo "<tr>";
echo "<td>ID</td>";
echo "<td>User</td>";
echo "<td>Title</td>";
echo "<td>Time</td>";
echo "<td>Eicon</td>";
echo "<td>Content</td>";
echo "</tr>";
for($i=0;$i<$msg_count;$i++)
{
$msg_info=explode("-",$msg_info[$i]);
echo "<tr>";
echo "<td>$msg_count-$i</td>";
echo "<td>".$msg_infop[0]."</td>";
echo "<td>".$msg_info[1]."</td>";
echo "<td>".$msg_info[2]".</td>";
echo "<td><img src="img\".$msg_info[3]."\"></td>";
echo "<td>".$msg_info[4]."</td>";
echo "</tr>";
}
echo "</table>";
}
echo "</center>";
echo "</body>";
echo "</html>";
?>
初学PHP。。 以上的代码为什么会出现HTTP500错误。。 求大神指点
echo "<html>";
echo "<head>";
echo "<title>";
echo "Reply Page";
echo "</title>";
echo "</head>";
echo "<body>";
echo "<center>";
echo "<font size=5>";
echo "Leave a Reply";
echo "</font>";
echo "<p>";
$file="data.txt";
$msg=file($file);
$msg_count=count($msg);
echo "当前共有留言.".$msg_count>.".条";
echo "<p>";
echo "<a href="submit.php">添加新留言</a>";
echo "<p>";
if($msg_count==0)
echo "没有留言..";
else
{
echo "<table border="1" bordercolor="blue">";
echo "<tr>";
echo "<td>ID</td>";
echo "<td>User</td>";
echo "<td>Title</td>";
echo "<td>Time</td>";
echo "<td>Eicon</td>";
echo "<td>Content</td>";
echo "</tr>";
for($i=0;$i<$msg_count;$i++)
{
$msg_info=explode("-",$msg_info[$i]);
echo "<tr>";
echo "<td>$msg_count-$i</td>";
echo "<td>".$msg_infop[0]."</td>";
echo "<td>".$msg_info[1]."</td>";
echo "<td>".$msg_info[2]".</td>";
echo "<td><img src="img\".$msg_info[3]."\"></td>";
echo "<td>".$msg_info[4]."</td>";
echo "</tr>";
}
echo "</table>";
}
echo "</center>";
echo "</body>";
echo "</html>";
?>
初学PHP。。 以上的代码为什么会出现HTTP500错误。。 求大神指点
引号都没有转义<?php
echo "<html>";
echo "<head>";
echo "<title>";
echo "Reply Page";
echo "</title>";
echo "</head>";
echo "<body>";
echo "<center>";
echo "<font size=5>";
echo "Leave a Reply";
echo "</font>";
echo "<p>";
$file="data.txt";
$msg=file($file);
$msg_count=count($msg);
echo "当前共有留言.".$msg_count.">条";
echo "<p>";
echo "<a href='submit.php'>添加新留言</a>";
echo "<p>";
if($msg_count==0)
echo "没有留言..";
else
{
echo "<table border=\"1\" bordercolor=\"blue\">";
echo "<tr>";
echo "<td>ID</td>";
echo "<td>User</td>";
echo "<td>Title</td>";
echo "<td>Time</td>";
echo "<td>Eicon</td>";
echo "<td>Content</td>";
echo "</tr>";
for($i=0;$i<$msg_count;$i++)
{
$msg_info=explode("-",$msg_info[$i]);
echo "<tr>";
echo "<td>$msg_count-$i</td>";
echo "<td>".$msg_infop[0]."</td>";
echo "<td>".$msg_info[1]."</td>";
echo "<td>".$msg_info[2]."</td>";
echo "<td><img src=\"img\"".$msg_info[3]."></td>";
echo "<td>".$msg_info[4]."</td>";
echo "</tr>";
}
echo "</table>";
}
echo "</center>";
echo "</body>";
echo "</html>";
?>
echo "当前共有留言.".$msg_count>.".条";
多了个 >19行
echo "<a href="submit.php">添加新留言</a>";
引号中的引号没转义
echo "<a href=\"submit.php\">添加新留言</a>";25行
echo "<table border="1" bordercolor="blue">";
同上41行
echo "<td>".$msg_info[2]".</td>";
应为
echo "<td>".$msg_info[2]."</td>";等等....
Default Value: On
Development Value: On
Production Value: Off; display_startup_errors
; Default Value: Off
; Development Value: On
; Production Value: Off error_reporting
Default Value: E_ALL & ~E_NOTICE
Development Value: E_ALL | E_STRICT
Production Value: E_ALL & ~E_DEPRECATED
作出如上修改后连接另一个使用数据库的页面出现以下提示
Your PHP installation appears to be missing the MySQL extension which is required by
求指点如何具体设置php.ini 报错
至于出现一条错误,那是因为这条错误足以致命,程序已经终止了自然不会发现后面的错误
<?php
這裏開始php
?>
html...比如你上面這裏<?php
echo "<html>";
echo "<head>";
echo "<title>";
echo "Reply Page";
echo "</title>";
echo "</head>";
echo "<body>";
echo "<center>";
echo "<font size=5>";
echo "Leave a Reply";
echo "</font>";
echo "<p>";
$file="data.txt";修改一下:
<html>
<head>
<title>
Reply Page
</title>
</head>
<body>
<center>
<font size=5>
Leave a Reply
</font>
<p>
<?php
//這裏開始你的php部分代碼
$file ="data.txt
?>
這麼寫,養成習慣,不要再用echo 輸出 html了.這樣寫你很累,電腦也很累,看的人也很累...
else
{
echo "<table border="1" bordercolor="blue">";
echo "<tr>";
echo "<td>ID</td>";
echo "<td>User</td>";
echo "<td>Title</td>";
echo "<td>Time</td>";
echo "<td>Eicon</td>";
echo "<td>Content</td>";
echo "</tr>";
//可以用界定符修改成
$tableTH =<<<tablehead
</tr>
<td>ID</td>
<td>User</td>
<td>Title</td>
<td>Time</td>
<td>Eicon</td>
<td>Content</td>
</tr>
tablehead;
//注意上面需要緊貼着行首,不能有空格.
echo $tableTH;
把那个报错的注释了 问题就解决了 。。
那是你的mysql擴展還沒有激活...
寫一個php文檔
<?php
echo phpinfo();
?>將Loaded Configuration File 顯示的php.ini文件打開 並且 找到 extesion = mysql.dll 如果前面有;(分號)
去掉,保存,重啓 apache...(你的phpnow?)
然後再執行 剛剛的測試php文件看看是否正常了.
回到你的phpinfo 這個測試頁面 看看
有沒有mysql 這個部分?
MySQL Support enabled 什麼的...要是這些都正常 那就神奇了.
phpnow 我也沒用過 如果可行的話 你去換這個
http://www.apachefriends.org/zh_cn/xampp-windows.html安裝前將你的phpnow 給卸載了.
打屁股 不過 無所謂了 也是裝成xampp吧 之前的卸載
我在跟他的這個問題作出如上修改后连接另一个使用数据库的页面出现以下提示
Your PHP installation appears to be missing the MySQL extension which is required by
你現在代碼是怎麼樣的,在哪個地方出現錯誤?重新描述一下吧.另外裝的apache+php?還是裝的什麼集成安裝包呢