我有简单的带有php的html页面,如下所示:
<!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>
<title>Articles 'n' More::Articles</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Articles, Management , english, computers, sharepoint, wp7, bio technology, nano technology, c#">
<meta name="keywords" content="Articles, Management , english, computers, sharepoint, wp7, bio technology, nano technology, c#">
<link rel="stylesheet" type="text/css" href="CSS/Style.css" />
</head>
<body>
<table border="1" width="100%">
<tr id="header" >
<td height="30%" width="100%" colspan="3">
<?php include("Header.php"); ?>
</td>
</tr>
<tr id="body">
<td width="15%" valign="top" align="left">
<table width="100%" border="3" align="left">
<tr ><td>
<?php include("LeftPanel.php"); ?>
</td>
</tr>
</table>
</td>
<td width="75%" valign="top">
<!--Articles-->
<?php
$articlePerPage="10";
$subcatID = $_GET['subcatid'];
$curPageId = $_GET['pageId'];
$nextPageId=$curPageId+1;
$prevPageId=$curPageId-1;
$con=mysql_connect('localhost','root','');
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("articles_db",$con);
$query="";
$queryCount="";
if($subcatID == "0")
{
$queryCount="select count(1) total from tbl_articles";
//echo "QueryCount is".$queryCount;
}
else
{
$queryCount="select count(1) total from tbl_articles where SUBCATEGORY_ID=".$subcatID;
}
$resultCount= mysql_query($queryCount);
$rowCount = mysql_fetch_array($resultCount);
$totlaArticles= $rowCount['total'] ;
//echo 'total articles'.$totlaArticles;
if($subcatID == "0")
{
$query="select * from (SELECT ARTICLE_ID,TITLE,CONTENT,POSTED_ON,POSTED_BY FROM TBL_Articles order by POSTED_ON desc limit ".$articlePerPage*$curPageId.") sub order by POSTED_ON asc limit ".$articlePerPage;
//echo $query;
}
else
{
$query="select * from (SELECT ARTICLE_ID,TITLE,CONTENT,POSTED_ON,POSTED_BY FROM TBL_Articles where SUBCATEGORY_ID=".$subcatID." order by POSTED_ON desc limit ".$articlePerPage*$curPageId.") sub order by POSTED_ON asc limit ".$articlePerPage;
}
$result = mysql_query($query);
?>
<table width="100%">
<tr id="repeatingRow" valign="top">
<td width="100%">
<?php
$count=0;
while($row = mysql_fetch_array($result))
{
$id= $row['ARTICLE_ID'] ;
$title= $row['TITLE'] ;
$content= $row['CONTENT'] ;
$count=$count+1;
if(strlen($content)< 110)
{
$content=substr($content,0,strlen($content));
}
else
{
$content=substr($content,0,100);
}
$postedon=$row['POSTED_ON'] ;
$author = $row['POSTED_BY'] ;
?>
<table width="100%">
<tr>
<th width="100%" colspan="3">
<a href="ShowArticle.php?articleid= <?php echo $id ; ?>&title=<?php echo $title ; ?>"><?php echo $title ; ?></a></th>
</tr>
<tr >
<h6>
<td width="30%" align="left"><img src="Images/account.png" /><?php echo $author ; ?></td>
<td width="30%" align="left"><img src="Images/clock.png" /><?php echo $postedon ; ?></td>
<td width="40%" align="left"><img src="Images/folder.png" />General</td>
</h6>
</tr>
<tr>
<td width="100%" colspan="3"><br/><?php echo $content ;?><br />
<hr color="#49a6e1">
</td>
</tr>
</table>
<?php
}
?>
</td>
</tr>
<tr>
<td align="center">
<b>
<?php
//echo $subcatID;
//echo ("<a href='Articles.php?subcatid=".$subcatID."&pageId=".$prevPageId."'>Previous</a>");
if($curPageId>1)
{
echo ("<a href='Articles.php?subcatid=".$subcatID."&pageId=".$prevPageId."'>Previous</a>");
//echo ("<a href='Articles.php'>Previous</a>");
}
?>
</b>
</td>
<td>
<b>
<?php
if($totlaArticles/($curPageId*10)>1)
{
echo ("<a href='Articles.php?subcatid=".$subcatID."&pageId=".$nextPageId."'>Next</a>");
//echo "<a href='Articles.php?subcatid='".echo $subcatID."@pageId= ".$nextPageId.">Next</a>"
}
?>
</b>
</td>
</tr>
</table>
</td>
<td height="65%" width="10%" valign="center">
<!--Right panel-->
</td>
</tr>
<tr id="footer" bgcolor="dfdfdf">
<td height="5%" colspan="3">
count is : <?php echo $count; include("Footer.php"); ?>
<!-- do not get this part when upload on server -->
</td>
</tr>
</table>
</body>
</html>
当我在本地计算机上尝试时,此页面会显示所需的结果。 但是当我将它上传到我的主机服务器时,我面临以下问题:
在我的本地机器上我有XAMPP(Basispaket)版本1.7.4与php 5.3.5和在服务器上我有版本5.2.6(作为CGI应用程序运行)
是否有人知道为什么我面临这个问题以及可能的解决方案。
答案 0 :(得分:1)
标记看起来很奇怪,我在底部找到了错误消息:
Failed loading D:\ioncube\ioncube_loader_win_5.2.dll
Failed loading D:\ioncube\ioncube_loader_win_4.4.dll
好的,我认为文件中存在问题,例如你包括(LeftPanel.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>
...
当您包含此内容时 - 标记中断。
答案 1 :(得分:1)
footer.php问题可能与大写问题有关。 php文件是否首字母大写?如果不完全正确,某些服务器将会例外。
答案 2 :(得分:0)
最后我想通了。 内容存储在数据库中的问题,它包含一些代码和一些要在网页上显示的xml。 所以我只使用了这两行
<?php
$content=htmlentities($content);
echo "<pre><code>".$content."</code></pre>"
?>
它工作正常。
对于我使用风格的背景颜色,现在它正在工作。