未定义的偏移量1 [英] Undefined offset 1
本文介绍了未定义的偏移量1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好...
我面临的问题是未定义的偏移量:第3行。我无法理解它是什么类型的错误。
任何人都可以告诉我,为什么这样的错误发生在PHP
Hello ... I am facing a problem that undefined offset :1 in line 3. I can't understand that what type of error it is. Can anyone tell me that why such error occurs in php
未定义的偏移量在行中:3
Undefined offset in line : 3
foreach ($lines as $line)
{
list($var,$value) = explode('=', $line); //line 3
$data[$var] = $value;
}
推荐答案
c $ c> notice ,因为您试图访问未设置的数组索引。
Your are getting PHP notice
because you are trying to access an array index which is not set.
list($var,$value) = explode('=', $line);
以上这行代码展示了字符串 $ line
在 $ var
和 =
并分配 0th
code>第1 值在 $ value
中。当 $ line
包含一些没有 =
的字符串时,就会出现问题。
The above line explodes the string $line
with =
and assign 0th
value in $var
and 1st
value in $value
. The issue arises when $line
contains some string without =
.
这篇关于未定义的偏移量1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文