错误通知未定义索引

时间:2016-05-30 09:19:03

标签: php notice undefined-index

虽然已定义索引,但我收到了未定义的索引通知。 PHP版本是5.6

代码:

$url = $_SERVER['REQUEST_URI'];
$array = explode('?', $url);

var_dump($array);

echo "<br>".$array[0]."<br>";
echo "this is value 1:".$array[1]."<br>"; //line 9

输出:

array(2) { [0]=> string(10) "/customers" [1]=> string(9) "name=test" }
/customers
this is value 1:name=test

这一切都有道理,但我也注意到了这一点:

  

PHP注意:未定义的偏移:1英寸   第9行的/var/source/united/magebo/api/api.php

知道这个通知的来源吗?

我尝试将硬编码的网址设置为相同的值,通知消失。我发现了有关此问题的所有问题,但在我的情况下,索引 IS 已定义。

0 个答案:

没有答案