php代码:
1. if (isset($data['city_id']))
2. {
3. $city_id = "city_id='". $data['city_id']. "', ";
4. }
我得到了:
注意:未定义的索引:第3行的city_id
这怎么可能?
答案 0 :(得分:0)
只需运行您的代码示例,它就能完美运行,我没有得到未定义的索引'错误 - 把我们带到大苹果
<?php
$data['city_id']='New York';
if (isset($data['city_id']))
{
$city_id = "city_id='". $data['city_id']. "', ";
echo $city_id;
}
?>
输出:city_id =&#39;纽约&#39;,
当然,如果没有$data['city_index']='New York';
我只是得到一个空白屏幕,因为if
条件不符合 - 没有错误。