2
我一直在本地開發一個項目(在MAMP中),並決定將它上傳到我的LAMP服務器上。此服務器以前工作,但上傳所有我的新內容後,它不是呈現HTML,只是顯示純文本的源代碼。PHP製作的HTML內容呈現爲明文
所有PHP似乎都正常工作,因爲它顯示正確的內容。
無濟於事,我試着明確地設置內容類型爲header("Content-Type: text/html")
。當我刪除PHP包括,而是直接使用HTML,但是,它工作正常。
我使用的是的index.php文件包括其他幾個:
<?php
include_once 'header.php';
include_once 'inc/window.php';
createWindow();
include_once 'footer.php';
?>
也許我的header.php文件可能包含一些線索,以及:
<?php session_start(); ?>
<!doctype html>
<html>
<?php
include_once 'inc/files.php';
$files = json_decode(getFiles($ids));
?>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<?php
$title = '';
foreach($files as $i=>$file){
$title .= $file->content . ' ';
if(count($file) > 1 && $i < count($file)-1) $title .= '+ ';
}
?>
<title>* <?php echo strtolower($title); ?></title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet/less" type="text/css" href="css/main.css">
<script src="js/libs/modernizr-2.0.6.min.js"></script>
</head>
<body>
我的環境運行PHP5 +(5.3我相信?),Ubuntu和Apache2。我也有webmin和SSH訪問。
任何想法,將不勝感激!
強尼
這兩句話好像說相反的事情:1),但上載我的所有新內容後,不渲染HTML,只是顯示的源代碼以純文本格式。 2)所有PHP似乎都正常工作,因爲它顯示正確的內容。 ---請解釋什麼是或不是工作更清楚 – Zak 2013-04-24 00:03:39
我的意思是說,它正在運行PHP代碼並正確地從數據庫中讀取信息,運行所有必要的邏輯,並輸出正確的HTML。它只是不會像HTML那樣在瀏覽器中呈現 - 它看起來就像我在頁面上使用「查看源代碼」一樣。 – 2013-04-24 00:06:16
它在網絡上?我們可以得到url – 2013-04-24 00:10:45