我在 php 中所做的这个包含语句有什么问题?

2022-01-25 00:00:00 syntax-error include php html parse-error
<?php

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

我希望将文章发布在我的网站上,但它给出了错误:

解析错误:语法错误,第 1 行/opt/lampp/htdocs/white_coats/articles/article_6.html 中的意外版本"(T_STRING)

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

推荐答案

article_6.html 没有 php 标签.它只是一个保存在 .html 中的 word 文件,以便可以在网站上显示.这只是一篇带有一些图片的文章.

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 或文本内容.

Then you don't include it. You read it's contents and print em. Include statements are nearly always for code includes and not plain html or text content.

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

相关文章