我用php設計了我的網站,它在wamp服務器上工作正常,但是當我將我的PHP網站上傳到我的主機,並且我去了我的網站地址時,我只看到了白色頁面(它只顯示正確的頁面標題!)
我用了一些包含句子,指向父目錄,使用兩點「../」 您認爲這可能是問題的根源嗎?
請向我推薦一種查找錯誤並進行調試的方法。
這是我的第一個頁面代碼:(我應該指出,例如當我去content.php它顯示正確的)爲什麼我在我的主機上上傳我的php時看到白頁?
<?php
include("includes/classes/mysession.php");
$ms=new Mysession("turkish_az","home");
$ms->setCurrentPage("home");
if(isset($_GET["slc_language"])){
$ms->setLanguage($_GET["slc_language"]);
}
?>
<!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>Untitled Document</title>
<link href="includes/css/style_header.css" rel="stylesheet" type="text/css" />
<link href="includes/css/style_home.css" rel="stylesheet" type="text/css" />
<link href="includes/css/syle_footer.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="includes/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
$("#slc_language").val("<?php echo($ms->getLanguage());?>");
$("#form_search").submit(function(e) {
var data=$(this).serialize();
e.preventDefault();
$.ajax({
type: 'POST',
url: 'pages/meaning/mean.php',
data: data,
success: function(resp){
$("#resultpart").html(resp);
}
});
});
});
</script>
</head>
<body>
<div id="container">
<?php require("pages/header/header.php"); ?>
<?php require("pages/main/content.php"); ?>
<?php require("pages/footer/footer.php"); ?>
</div>
</body>
</html>
我檢查hedear &內容&頁腳PHP文件:
1--像第一頁
2,內容首部演出的白色頁面顯示正確
3頁腳顯示一半正確的,但有一個錯誤:
Fatal error: Call to a member function getLayoutName() on a non-object in /home/u998326115/public_html/pages/footer/footer.php on line 14
添加在你的主機,檢查是否有一個名爲「error_log中」文件。如果存在,請下載並查看最後一行的內容。 – Gary 2014-11-06 11:04:10
我認爲您的代碼存在一些錯誤,並且關閉了錯誤報告或顯示錯誤。在文件的頂部添加'error_reporting('E_ALL');'和'display_errors(1);'。 – vaso123 2014-11-06 11:06:50
@ GaryLuck->我搜索了它,它不存在。 – 2014-11-06 11:07:50