PHP INCLUDE函数在HTML文件中 [英] PHP INCLUDE function inside an HTML file

查看:241
本文介绍了PHP INCLUDE函数在HTML文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML文件,里面有一个相当长的导航菜单。我想从HTML中取出菜单并将其放入外部PHP页面,然后使用

<?php include' navigation.php; ?> 在HTML文件中。

我试过把这个添加到HTML文件中,但它不显示任何内容以及页面上没有错误。

我需要做什么(如果甚至有可能)保留文件HTML并使用php require功能?

解决方案

在您的httpd.conf中添加此代码,然后您可以在HTML页面上处理PHP代码。 b

  AddHandler application / x-httpd-php .php .html 


I have an HTML file that has a rather long navigation menu inside of it. I want to take that menu out of the HTML and place it into an external PHP page and then call it with

<?php include 'navigation.php'; ?> in the HTML file.

I have tried just adding this into the HTML file but it doesn't display anything as well as no errors on the page.

What do I need to do (if it's even possible) to keep the files HTML and use the php require function?

解决方案

Add this in in your httpd.conf and then you can process PHP code on HTML pages

AddHandler application/x-httpd-php .php .html

这篇关于PHP INCLUDE函数在HTML文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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