fastadmin获取关联表数据select渲染

fastadmin获取关联表数据select渲染_第1张图片

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>

你可能感兴趣的:(fastadmin,php)