Php 虽然在打印数组时找到了索引,但定义数组索引时出错
我试图使用(KEY)在另一个数组中创建一个数组,当我试图打印母数组时,子数组出现在其中,但编译器给了我一个错误,下面是我的代码Php 虽然在打印数组时找到了索引,但定义数组索引时出错,php,codeigniter,Php,Codeigniter,我试图使用(KEY)在另一个数组中创建一个数组,当我试图打印母数组时,子数组出现在其中,但编译器给了我一个错误,下面是我的代码 $reps_conts["filters"] = array(); foreach($data as $key => $div){ if($div == "compls"){ $reps_conts["filters"]["scompls"] =
$reps_conts["filters"] = array();
foreach($data as $key => $div){
if($div == "compls"){
$reps_conts["filters"]["scompls"] = "scompls";
}
if($div == "obsts"){
$reps_conts["filters"]["sobsts"] = "sobsts";
}
if($div == "notes"){
$reps_conts["filters"]["snotes"] = "snotes";
}
}
print_r($reps_conts);
$this->load->view('mitronik/aggregation-result' ,array('data' => $reps_conts));
这是我打印数组时的输出($reps\u conts)
数组([235]=>数组([HEAD]=>114705[COMPL]=>数组
2019.董事会[OBST]=>[注]=>[批准]=>1[董事会名称]=>
[批准]=>数组([235]=>1[1332]=>0
[1128]=>0)[filters]=>Array([scompls]=>scompls])一个PHP
遇到错误严重性:请注意
消息:未定义索引:筛选器
文件名:mitronik/aggregation-result.php
电话号码:18
回溯:
文件:
/var/www/html/itachievents/application/views/mitronik/aggregation-result.php
行:18函数:\u错误\u处理程序
文件:/var/www/html/itachievents/application/controllers/Welcome.php
行:353功能:视图
文件:/var/www/html/itachievents/index.php行:315函数:
需要一次
你能添加更多的代码吗?第18行显示错误,但在代码中不可见。请添加“aggregation result.php”文件代码。它在第18行显示文件中的错误是的,我签出了文件“aggregation result.php”。有一个foreach子句检查数组,必须排除数组中的一些键。我排除了这些键,现在工作正常,非常感谢Amarat。您能添加更多代码吗?第18行显示错误,但在代码中不可见。请添加“aggregation result.php”文件代码。它在第18行显示错误是的,我签出了文件“aggregation result.php”。有一个foreach子句检查数组,必须排除数组中的一些键。我排除了这些键,现在工作正常,非常感谢Amarat