2016-07-21 37 views
2

以下Php文件可以與Mozilla Firefox完美兼容。但是,在Google Chrome上運行相同的操作時,結果 - 它顯示整個HTML代碼而不是呈現它。基本上表明Google Chrome瀏覽器無法理解並顯示HTML代碼。HTML呈現問題 - 適用於Mozilla Firefox,但不適用於Google Chrome

abc.php文件

<?php 
session_start();//session is a way to store information (in variables) to be used across multiple pages. 
?> 
<!DOCTYPE html> 
<html> 
<head> 
<script src="https://code.jquery.com/jquery-1.12.3.js"></script>   
.... //some lines of code 
</html> 

回答

1

問題

而Firefox瀏覽器解析和渲染HTML代碼。 Google Chrome無法理解php文件本身就是HTML代碼。

在DOCTYPE線作爲文件

因此的第一行的放置的變化在指示文件類型的DOCTYPE線的定位被顯示在瀏覽器。

abc.php文件

<!DOCTYPE html> 
<?php 
session_start();//session is a way to store information (in variables) to be used across multiple pages. 
?> 

<html> 
<head> 
<script src="https://code.jquery.com/jquery-1.12.3.js"></script>   
.... //some lines of code 
</html> 
+0

無法啓動會議前給出任何輸出... –

+0

沒明白爲什麼它downvoted。自從我解決了問題,用同樣的解決方案。將DOCTYPE行作爲文件第一行的位置非常重要 –

+0

我已將其恢復爲投票,但在開始會話之前<!DOCTYPE html> –

相關問題