itommy
V2EX  ›  问与答

入门级php问题

  •  
  •   itommy · Jan 21, 2012 · 4047 views
    This topic created in 5317 days ago, the information mentioned may be changed or developed.
    代码是在mac上写的和测试的, mamp, localhost测试,网站显示没有问题;

    但,在ec2上的lamp 和 xampp 跑同样的代码都出现了以下内容:

    "notice: undefined index: status in c:\xxx\xx.php on line 4"

    下面是php file里的line 4:

    " if($_GET['status'] == 'logout'){ "

    可以理解为什么会显示那个"undefined index"的notice, 但为什么在mamp上测试的时候就不显示呢?

    先谢谢各位大牛. :)
    4 replies    1970-01-01 08:00:00 +08:00
    yesmeck
        1
    yesmeck  
       Jan 21, 2012
    可以检查一下php.ini里的error_reporting和display_errors这两个配置
    jkeylu
        2
    jkeylu  
       Jan 21, 2012 via Android
    $_GET 数组中没有 status 这个索引,原因是访问当前地址时没有 &status=something ,可以使用前判断是否设置
    if (isset($_GET['status']))
    itommy
        3
    itommy  
    OP
       Jan 21, 2012
    @yesmeck 明白了!看到了里面 error_reporting的 配置。 谢谢!
    itommy
        4
    itommy  
    OP
       Jan 21, 2012
    @jkeylu 恩恩, 明白这个产生这个 notice 的缘故,只是不知道为什么在mamp上没有,在lamp 和xampp上都有。 是因为php.ini里面的配置difference, 如yesmeck所说。

    thanks, anyway. :)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   930 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 21:49 · PVG 05:49 · LAX 14:49 · JFK 17:49
    ♥ Do have faith in what you're doing.