我正在尝试使用 xampp 将编辑页面添加到我的 laravel 网站,但是当我尝试运行该链接时,它显示“语法错误,文件意外结束”。这是我得到的错误:<?php echo $__env->make('master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\webLaravel\resources\views/edit.blade.php ENDPATH**/ ?>参数“语法错误,文件意外结束”我已经尝试在 PostController.php 上更改我的编辑功能public function edit($id){ $post = DB::table('posts')->where('id_kategori',$id)->get(); return view('edit',['posts'=>$post]);}这是我的 index.blade.php 上的按钮 <td><a href="/post/edit/{{ $post->id_kategori }}"><button type="button" class="btn btn-edit stn-md">Edit </button></td>这是我在 web.php 中创建的路由Route::get('/post/edit/{id}','PostController@edit');
2 回答
慕后森
TA贡献1802条经验 获得超5个赞
因为,您正在使用 获取数据get(),所以我假设您正在使用@foreach循环遍历表中的数据。您需要确保@foreach使用@endforeach刀片指令关闭循环来关闭循环。另外,请确保您正在关闭所有@ifwith@endif指令。
@foreach
.
.
.
.
@endforeach
慕标5832272
TA贡献1966条经验 获得超4个赞
从您的代码示例看来,您缺少结束 A 标记!
您也不需要使用按钮和 A 标签。试试这个...
<td>
<a class="btn btn-edit stn-md" href="/post/edit/{{ $post->id_kategori }}"> Edit </a>
</td>
- 2 回答
- 0 关注
- 120 浏览
添加回答
举报
0/150
提交
取消