以下代码是错误的,有人知道如何编写正确的代码吗?
foreach(explode('|',$btn) as $b)
foreach(explode('|',$param) as $p)
DB::insert("insert into commands (buttons, parameters) values (?, ?)", [$b, $p]);
我解决了:)
这里:
$b = explode('|', $btn);
$p = explode('|', $param);
$c = array_combine($b,$p);
foreach($c as $d => $key)
DB::insert("insert into commands (buttons, parameters) values (?, ?)", [$d, $key]);