fastadmin获取关联表数据select渲染

2023-12-13 10:17:24

在这里插入图片描述

php

	public function piliangadd(){
        if (false === $this->request->isPost()) {
            $fenlei_list = Db::name('fenlei')->order('weigh desc')->select();
            $this->assign('fenleilist',$fenlei_list);
            return $this->view->fetch();
        }
		
        $fenlei = $this->request->post('fenlei');
        Db::startTrans();
        try {


            $videourllist = explode(',',$datalist);
            foreach ($videourllist as $key => $item){

            }

            Db::commit();
            $this->success('操作成功');
        } catch (Exception $e) {
            Db::rollback();
            $this->error($e->getMessage());
        }

    }

piliangadd.html

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('所属分类')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select name="fenlei" class="form-control">
                {foreach name="fenleilist" item="vo"}
                <option value="{$vo.id}">{$vo.fenlei}</option>
                {/foreach}
            </select>
        </div>
    </div>

文章来源:https://blog.csdn.net/hanzhuhuaa/article/details/134882222
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。