Php 本地包含
我的网站的所有页面都有相同的菜单。我想把它包含在所有带有.php文件的页面中 我用MAMP PRO创建了一个假的domani,在mu MAC上本地试用 我创建了index.html和其他页面:Php 本地包含,php,inclusion,Php,Inclusion,我的网站的所有页面都有相同的菜单。我想把它包含在所有带有.php文件的页面中 我用MAMP PRO创建了一个假的domani,在mu MAC上本地试用 我创建了index.html和其他页面: <html> <header> <title>Inclusion test</title> </header> <body> <ul> <li><a href="
<html>
<header>
<title>Inclusion test</title>
</header>
<body>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="pippo.html">Pippo</a></li>
<li><a href="pluto.html">Pluto</a></li>
</ul>
<h1>Welcome on Disneyland!</h1>
</body>
</html>
包含试验
欢迎来到迪斯尼乐园!
我创建了这个php文件:
<?php
echo "<a href="index.html">Home</a>";
"<a href="pippo.html">Pippo</a>";
"<a href="pluto.html">Pluto</a>";
?>
在我使用以下行规则将其包含在index.html中之后:
<?php include 'menu.php';?>
怎么了?将
index.html
的扩展名更改为index.php
。HTML文件不知道如何执行PHP代码
是一个PHP语句,但对于HTML文件,它只是一个句子(文本)谢谢,但我没有解析。我把所有的前缀从html改为php,但它不起作用!你确定我的php代码正确吗?