是否可以在php文件中包含一个html文件 [英] Is it possible to include an html file inside a php file

查看:79
本文介绍了是否可以在php文件中包含一个html文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在php文件中包含一个html文件,我尝试在php文件中使用 include require ,但不应用CSS样式,仅包含内容。有没有办法用样式和jquery包含完整的html文件?

I need to include a html file inside a php file, I tried using include and require in php file, but css styles are not applied and only the content is included. Is there a way to include the full html file with styles and jquery?

推荐答案

没有PHP脚本这样的东西。只有恰好包含PHP代码块的文件。您可以 include()您想要的任何内容,但除非该包含的文件有<?php ...?> 在某个地方阻塞,文件的内容将被视为输出。

There's no such thing as a PHP script. There's just files that happen to contain PHP code blocks. You can include() anything you want, but unless that included file has a <?php ... ?> block in it somewhere, the file's contents will simply be treated as output.

如果没有应用css,那么请确保你的样式表实际上是正在加载,并且HTML被包含在页面DOM中的适当位置。

If css isn't being applied, then make sure that that your style sheets are actually being loaded, and that the HTML is being included in the proper place in your page's DOM.

这篇关于是否可以在php文件中包含一个html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆