简体   繁体   English

如何使用 PHP 包含来显示 HTML 页面?

[英]How Do I Use PHP Includes to Display HTML pages?

I have my web page setup to use a new management system, but would also like to use some basic html pages for other content (such as images or whatever), and I seem to remember from years ago that there was a way to use PHP to load HTML pages that are not formatted into a content area, which I assume are DIVs.我的网页设置为使用新的管理系统,但也想将一些基本的 html 页面用于其他内容(例如图像或其他内容),而且我似乎记得多年前有一种使用 PHP 的方法加载未格式化到内容区域中的 HTML 页面,我假设它们是 DIV。

I also seem to remember that I didn't have to create an if statement, but I'm not sure and quite honestly I'm awfully confused about how to do this.我似乎还记得我不必创建 if 语句,但我不确定,老实说,我对如何执行此操作感到非常困惑。 A friend used to do this coding for me way back when, so the way it was setup was that all I had to do was tell my navigation where to find the file and it would load it inside of my index.php file.以前有个朋友曾经为我做这个编码,所以它的设置方式是我所要做的就是告诉我的导航在哪里可以找到文件,它会将它加载到我的 index.php 文件中。

Hopefully my question is clear, but if not, my website is right here , and I just want my HTML files to load into the are with the content image, but only the grey portion (which I do have a DIV set up for).希望我的问题很清楚,但如果没有,我的网站就在这里,我只希望我的 HTML 文件与内容图像一起加载到文件中,但只有灰色部分(我确实设置了 DIV)。 Any help would be much appreciated!任何帮助将非常感激! Thanks!谢谢!

The simplest way is by using require and include.最简单的方法是使用 require 和 include。 for more details, you can visit the following link: http://www.w3schools.com/php/php_includes.asp更多详情,您可以访问以下链接: http : //www.w3schools.com/php/php_includes.asp

For example:例如:

<?php include 'footer.html';?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM