dongwen9975 2014-12-24 14:07
浏览 21
已采纳

包括不工作(noobie)

So my include PHP tag is not working for some reason. (I do have wamp server installed, so i can open .php files in browser)

index.php:

 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>

 </head>
<body style="background-color: #292727;">

<?php
error_reporting(E_ALL);
  include('header.php');
?>




</body>
</html>

header.php:

<?php
error_reporting(E_ALL);
echo '  <div class="top_bar">

</div>

<div class="header_gif">
    <div class="header_overlay">    
    </div>
</div>

<div class="sponsor_bar">

</div>

<div class="navigation_bar">
    <div class="nav_container">
        <a href="index.php"><div class="nav_bar_box" id="home">HOME</div></a>
        <a href="index.php"><div class="nav_bar_box" id="brackets">BRACKETS</div></a>
        <a href="index.php"><div class="nav_bar_box" id="teams">TEAMS</div></a>
        <a href="index.php"><div class="nav_bar_box" id="news">NEWS</div></a>
        <a href="index.php"><div class="nav_bar_box" id="info">INFO</div></a>
    </div>
</div>'; 
?>

They are in the same folder. Do you have any idea why its not working?

  • 写回答

1条回答 默认 最新

  • doudu5498 2014-12-24 14:30
    关注

    Just having a _AMP stack installed does not magically make files load as PHP if you open them directly in your browser - they have to actually go through the server to be processed.

    Consequently, this is wrong:

    file:///C:/wamp/www/Rework%20E-spotd2c/premium/index.php
    

    Something like this would be right: (depending on the server's document root setting)

    http://localhost/index.php
    

    An additional note that may be helpful, for people developing with PHP 5.4 or newer, is the built-in server. Open a command line to the folder you want to use as the root (such as your project folder), and run the following command:

    php -S localhost:8000
    

    You can now go to http://localhost:8000/index.php in your browser and PHP will run! I use this all the time for testing stuff locally. To shut down the server, simply Ctrl+C the command window. You can also use php -S 192.168.0.128:8000 (put your LAN IP there) to let other users on your network access your test server stuff too, great for showing off to coworkers ;)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事: