function get($a,$b,$c) {
$y = explode($b,$a);
$x = explode($c,$y[1]);
return $x[0];
}
返回错误
注意:未定义的偏移量:
中的1
答案 0 :(得分:2)
$y[1]
未设置。
在通过爆炸运行之前,你需要检查一个值。
$y = explode( $b, $a );
if ( isset( $y[1] ) ) {
$x = explode( $c, $y[1] );
return ( isset( $x[0] ) ) ? $x[0] : '';
} else {
return '';
}
答案 1 :(得分:0)
这是一个警告,表示未设置数组键。
您可以使用php的相关功能,无论是否存在特定的数组键。
http://php.net/manual/en/function.array-key-exists.php
此功能可以帮助您。