我对php很陌生。我刚刚安装了嵌入在html中的xampp和php代码,对我不起作用。以下是header.php的代码
<?php
echo "hi"; /* this works */
?>
<header>
<h1 class="brand"><a href="index.html"><img src="img/logo.png" alt=""><span>InvestFirst</span></a></h1>
<ul class="nav sf-menu clearfix">
<li class="active"><a href="index.html">Home<span></span></a></li>
<li><a href="index-1.html">About Us<span></span></a></li>
<li><a href="contact.php">Contact Us<span></span></a></li>
<?php
echo "hello"; /* This does not work */
?>
</ul>
</header>我想我错过了一些在xampp的配置。在C:\xampp\apache\conf\httpd.conf和c:\xampp\apache\conf\httpd.conf都增加了这一行。但这没什么用
AddType应用程序/x .html .htm
发布于 2014-02-10 13:41:33
不知道是怎么回事。但是我卸载了xampp &再次安装了它。现在一切都很好。
发布于 2014-02-10 10:43:14
将代码保存为*.php文件。HTML不执行PHP代码,因为它只描述客户端页面的可视化。PHP在服务器上执行,因此需要一个不同的文件类型。
https://stackoverflow.com/questions/21674580
复制相似问题