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();
}
曾经蜡笔没有小新2017-06-26 10:54:21
Method added
$this->assign('data',$data);
View js
var data="{{$data}}";