包括html文件 [英] Including html files
问题描述
我正在寻找一种结合包含功能的方法。和
" here documents"因此,包含$ variables
的包含html文件将被扩展和处理(通常打印到stdout)。
它将类似于:
print<<< HERE
包括file.html;
HERE;
除了当然,这不会起作用。文字include
file.html;将被打印,不会包含任何文件。因此需要
作为其他语法。 php支持吗?
I am looking for a way to combine the functionality of "include" and
"here documents" so that an included html file containing $variables
is expanded and handled (normally printed to stdout).
It would be something like:
print <<<HERE
include file.html;
HERE;
except that, of course, this won''t work. The text "include
file.html;" will be printed and no file will be included. So it needs
to be some other syntax. Does php support this?
推荐答案
变量
被扩展和处理(通常打印到stdout)。
它类似于:
print<<< HERE
包括file.html;
这里;
除了当然,这不会起作用。文字include
file.html;将被打印,不会包含任何文件。因此需要
作为其他语法。 php是否支持这个?
variables
is expanded and handled (normally printed to stdout).
It would be something like:
print <<<HERE
include file.html;
HERE;
except that, of course, this won''t work. The text "include
file.html;" will be printed and no file will be included. So it needs
to be some other syntax. Does php support this?
David Johnson写道:
David Johnson wrote:
我正在寻找一种方法来结合include的功能;和
这里的文件因此,包含
I am looking for a way to combine the functionality of "include" and
"here documents" so that an included html file containing
变量
的包含html文件将被扩展和处理(通常打印到stdout)。
它将类似于: />
打印<<< HERE
包括file.html;
这里;
除了,当然,这不会起作用。文字include
file.html;将被打印,不会包含任何文件。因此需要
作为其他语法。 php支持吗?
variables
is expanded and handled (normally printed to stdout).
It would be something like:
print <<<HERE
include file.html;
HERE;
except that, of course, this won''t work. The text "include
file.html;" will be printed and no file will be included. So it needs
to be some other syntax. Does php support this?
只需使用include ....
....
....
包括(''file.html'');
....
....
文件的文本将被插入该位置并解析为
普通的html / php。
Simply use include....
....
....
include(''file.html'');
....
....
The text of the file will be inserted at that position and parsed as
normal html/php.
这篇关于包括html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!