当前位置: 首页 > 工具软件 > xm-select > 使用案例 >

thinkphp使用xm-select

彭高畅
2023-12-01
        <div class="layui-input-inline">
            <div id="demo1"></div>
        </div>

JS:

			var demo1 = xmSelect.render({
				el: '#demo1',
				language: 'zn',
				data: [
					{volist name="port" id="v"}
						{name: '{$v.name}', value: '{$v.value}'},
					{/volist}
				]
			})

controller:

			View::assign('port', get_cks_port());
            return view();

common

function get_cks_port(){
    // $result ="{name: '张三', value: 1},  {name: '李四', value: 2},  {name: '王ERWER', value: 3} ";
    $port = Db::name('port')
        ->field("portcode value,cname name")
        ->select()->toArray();

    return $port;

};

 类似资料: