tp5 foreach两表联合插入数据

        if (request()->isGet()) {
            $ob = input('get.');

            $w['name'] = trim($ob['name']);
            $w['zt'] = "!!!!!";
            $w['time'] = time();
            $ids = db('goumai')->insertGetId($w);
            foreach ($ob['zx'] as $val) {
                $obb['shangpin'] = $val;
                $obb['aid'] = $ids;
                db('spid')->insert($obb);
            }
        }

HTML代码

<input type="hidden" value="{$vo.item_name}" name="zx[]">

zx是一个数组,foreach将数据排列是一个两表联合插入。

上一篇:ibatis iterate VS mybatis foreach


下一篇:SpringCloud(Hoxton.SR3)基础篇:第五章、Hystrix-request collapsing(请求合并)