$ _GET。未定义的变量。无法找到解决方案

时间:2014-10-20 01:38:21

标签: php get url-parameters

我遇到了一个问题并且没有想法。

我正在尝试从URL中获取参数,但PHP坚持说该变量未定义。

网址为

http://localhost/trendwatcher/index.php?date=2014-10-18

脚本就像

<?php include "header.php"; ?>

        <section id="stats">
            Showing trends for <?php echo $GET_["date"];  ?>
        </section>

最后,错误:

Showing trends for 
Notice: Undefined variable: GET_ in C:\xampp\htdocs\trendwatcher\index.php on line 4

有没有人有任何想法?

谢谢!

1 个答案:

答案 0 :(得分:1)

修复您的代码:

<section id="stats">
     Showing trends for <?php echo $GET_["date"];  ?>
</section>

<section id="stats">
     Showing trends for <?php echo $_GET["date"];  ?>
</section>