admin管理员组文章数量:1794759
Trying to access array offset on value of type null
报错: Trying to access array offset on value of type null 框架: thinkphp5.1+layui 问题分析: (前台界面) (后端代码)
//编辑渲染 public function edit(Request $request) { $result = RcryModel::get($request->param('bh')); $this -> view -> assign('result', $result); return $this -> view -> fetch('edit'); }(前端代码)
<form class="layui-form"> <input type="hidden" id="bh" name="bh" autocomplete="off" class="layui-input" value="{$result.bh}" > </form> <script> 部分代码如下①: {field: 'id', title: 'ID', width: '5%',hide:'true',templet:function(d){return '<div style = "text-align:center">'+d.id+'</div>'},} 部分代码如下②: content: ['{:url("Rcry/edit")}?bh=' + data.bh, 'yes'], </script>错误原因: 数据库中rcry表无bh字段,而是id。故而,当点击编辑的时候,无法获取数据表格中的bh信,$result为空。将前后端传值的bh均改为id即可解决问题。
本文标签: arrayAccessoffsetnulltype
版权声明:本文标题:Trying to access array offset on value of type null 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686959640a122388.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论