Wil*_*ner 3 php arrays string warnings
我从 if 语句中的数组中收到非法字符串偏移警告
411. if (is_array($attrib['affixes'])) { // merge
412. $new_affix = array_merge($attrib['affixes'], $new_affix);
413. }
Run Code Online (Sandbox Code Playgroud)
正是警告是
“警告:C:\xampp\htdocs\pengakar-master\src\Pengakar.php 中第 411 行的非法字符串偏移量'词缀'”
我在下面插入完整的代码:
另一部分还好。只有得到错误的那部分
谢谢您的帮助。
小智 5
非法偏移量意味着您引用的索引不存在。因此,在这种情况下,永远不会定义数组的“词缀”索引。为防止该错误,将代码更改如下:
if (isset($attrib['affixes']) && is_array($attrib['affixes'])) { // merge
$new_affix = array_merge($attrib['affixes'], $new_affix);
}
Run Code Online (Sandbox Code Playgroud)
在此处查看有关错误的更多信息: Illegal string offset Warning PHP
| 归档时间: |
|
| 查看次数: |
13652 次 |
| 最近记录: |