douyan1882
2014-02-10 10:27
浏览 26
已采纳

同一文件中的html和php语法不能正常运行xampp配置

I am new to php. I just installed xampp and php code embedded within html does not work for me. The following is the code for 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>

I guess I missed out some configuration in xampp. Have added this line at C:\xampp\apache\conf\httpd.conf and at c:\xampp\apache\conf\httpd.conf as well. But this doesnt help

AddType application/x-httpd-php .html .htm

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

  • douren5490 2014-02-10 13:41
    最佳回答

    Not sure what the issue was. But I uninstalled xampp & installed it again. It is working fine now.

    评论
    解决 无用
    打赏 举报
查看更多回答(1条)

相关推荐 更多相似问题