foreach ($good_info as $key => &$val) { $val['g_num'] = $vv[$key]; $val['ware_Beizu'] = $bb[$key]; }
[7]=> array(15) { ["id"]=> string(4) "1170" ["g_name"]=> string(12) "日本豆腐" ["g_images"]=> string(72) "http://xlddc.zkd.com/Public/Uploads/goods/2017-06-29/595450d5db86a.jpg" ["g_price"]=> string(1) "0" ["g_attr"]=> string(7) "90g/根" ["g_cd"]=> string(6) "中国" ["g_desc"]=> string(0) "" ["g_count"]=> string(3) "998" ["g_sum"]=> string(1) "1" ["g_cat"]=> string(3) "878" ["is_on_sale"]=> string(1) "1" ["g_sn"]=> string(5) "13033" ["g_cont"]=> NULL ["g_num"]=> string(1) "1" ["ware_Beizu"]=> string(12) "日本豆腐" } [8]=> &array(15) { ["id"]=> string(4) "1175" ["g_name"]=> string(9) "咸鸭蛋" ["g_images"]=> string(72) "http://xlddc.zkd.com/Public/Uploads/goods/2017-06-29/595456e6e0c73.jpg" ["g_price"]=> string(1) "0" ["g_attr"]=> string(3) "只" ["g_cd"]=> string(6) "中国" ["g_desc"]=> string(0) "" ["g_count"]=> string(3) "997" ["g_sum"]=> string(1) "2" ["g_cat"]=> string(3) "879" ["is_on_sale"]=> string(1) "1" ["g_sn"]=> string(10) "0401002002" ["g_cont"]=> NULL ["g_num"]=> string(1) "1" ["ware_Beizu"]=> string(9) "咸鸭蛋" } }
第八条 哪里怎么多了个& 怎么去掉&尼?
解决方案是永远不要用&
或者老老实实按照官网的指示,用unset解除引用
参考(之前提问): /q/10...
参考2(用&导致的“异常”行为): https://3v4l.org/hlJda
foreach ($good_info as $key => &$val) {
这个 & 是什么意思呢