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(); }
光阴似箭催人老,日月如移越少年。
Method added
$this->assign('data',$data);
View js
var data="{{$data}}";
Method added
View js