2014-12-24 53 views
-3
<?php 

    include("articles/article_6.html"); 
?> 

我想要的文章在我的網站上公佈,但它給人的錯誤:這是什麼問題,包括我在php做的聲明?

Parse error: syntax error, unexpected 'version' (T_STRING) in /opt/lampp/htdocs/white_coats/articles/article_6.html on line 1

+4

我們應該怎麼知道?我們不知道'article_6.html'中的內容。問題不在於你的include語句,除了你試圖包含HTML而不是PHP。但是,除非你在該文件中有PHP標籤,否則這應該不重要。 – Brad

+0

當你做'include'時,PHP基本上只是將該文件的內容複製並粘貼到腳本中。問題出在'article_6.html'文件中,就像錯誤顯示的那樣。 –

+0

article_6.html沒有php標籤。它只是一個保存在.html中的文件,以便它可以顯示在網站上。這只是一些有圖片的文章。 –

回答

2

article_6.html has no php tags. its just a word file that was saved in .html so that it could be displayed on the website. it's just an article with some pictures.

那你還不包括它。你閱讀它的內容和打印時間。包含語句幾乎總是用於代碼包含而不是純HTML或文本內容。

echo file_get_contents("articles/article_6.html"); 
+0

謝謝你,我明白了...... :) –