爆炸导致未定义的偏移量

时间:2015-11-07 08:08:17

标签: php

$arNotes = explode('<br>',$value[0]['notes']);
$arGenStatus = explode(':', $arNotes[1]);
$genStatusValue = explode('->', trim(preg_replace('/; /','',$arGenStatus[1])), 2);
var_dump($genStatusValue); exit;

当我var_dump或echo数组时,我产生以下值。

array(2) { [0]=> string(7) "closed " [1]=> string(10) " cancelled" } 

但是,下面的一个产生未定义的偏移1错误

if ($genStatusValue[1] == 'cancelled') {
    $op = '+';
}

1 个答案:

答案 0 :(得分:0)

您多次执行该代码。第一次一切都很好,花花公子。

不幸的是你使用exit(不要!),所以你下次没看到它真的失败了。

exit见证问题时删除var_dump

作为旁注:“这可能是一个错误吗?我正在使用php 5.6.14” - 这是一种非常糟糕的态度。

第一条规则:It's Always Your Fault.

相关问题