Is it possible to include an html file inside a php file(是否可以在 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 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否可以在 php 文件中包含 html 文件


基础教程推荐
- 在PHP中根据W3C规范Unicode 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01