在Linux if(isset($_GET))
{
$status = $_GET['status'];
$type = $_GET['type'];
$city = $_GET['city'];
$id = $_GET['id'];
}d
会报出变量没有定义 ,, 我的url 是这个样的 http://www.trip166.com/admin_space/lxs/lxs.php
会出现变量没有定义 ,, Linux 系统的
{
$status = $_GET['status'];
$type = $_GET['type'];
$city = $_GET['city'];
$id = $_GET['id'];
}d
会报出变量没有定义 ,, 我的url 是这个样的 http://www.trip166.com/admin_space/lxs/lxs.php
会出现变量没有定义 ,, Linux 系统的
//$status = $_GET['status'];
$status = !empty($_GET['status']) ? $_GET['status'] : '';//默认值自己定
Notice: Undefined index: status in /home/trip/public_html/admin_space/lxs/lxs.php on line 6
要书写健壮的代码
在外部变量使用前先检查是否有效
$status = isset($_GET['status']) ? $_GET['status'] : '';
不然,你要书写完全符合要求的代码,也是件麻烦的事。
Notice错误并不会影响什么。