javascript - How to assign the data queried in thinkphp5 controller to js?
大家讲道理
大家讲道理 2017-06-26 10:52:21
0
1
681

How to assign the data queried in thinkphp5 controller to js?

public function index(){
        $data = Db::name('menu') -> select();
        $data = node_merge($data);
        //这个$data如何传给前端js?
        return $this -> fetch();
    }
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
曾经蜡笔没有小新

Method added

$this->assign('data',$data);

View js

var data="{{$data}}";
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template