douyan1970 2015-03-11 18:00
浏览 52

php包含功能不工作的wamp

I'm fairly new to php, and I'm sure this is something simple. I have a php file named footer.php that contains the code I want at the end of every page, so I want to use an include function to do it. The file looks like this:

   <?php
   echo "<p>Copyright &copy; 1999-" . date("Y") . " W3Schools.com</p>";
   ?>

I then, in my main form, use an include statement like this:

    <html>
     <body>
     //other code//
      <?php include('footer.php');?>
    </body>
   </html>

The //other code// is stuff that isn't relevant and works fine.

I have my wamp server on, and both files are in the www folder in it. Any ideas why the include footer isn't showing up in my main file? I'm not getting any error messages in the log. Do I need to go into phpmyadmin or something?

  • 写回答

2条回答 默认 最新

  • donglieshe4692 2015-03-11 18:10
    关注

    Does your main file have a .php extension? If it is set to for instance index.html, the PHP include will not be executed and you will just see the HTML with no errors logged.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化