我正在嘗試使用 xampp 將編輯頁面添加到我的 laravel 網(wǎng)站,但是當(dāng)我嘗試運(yùn)行該鏈接時,它顯示“語法錯誤,文件意外結(jié)束”。這是我得到的錯誤:<?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**/ ?>參數(shù)“語法錯誤,文件意外結(jié)束”我已經(jīng)嘗試在 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 中創(chuàng)建的路由Route::get('/post/edit/{id}','PostController@edit');
2 回答

慕后森
TA貢獻(xiàn)1802條經(jīng)驗 獲得超5個贊
因為,您正在使用 獲取數(shù)據(jù)get(),所以我假設(shè)您正在使用@foreach循環(huán)遍歷表中的數(shù)據(jù)。您需要確保@foreach使用@endforeach刀片指令關(guān)閉循環(huán)來關(guān)閉循環(huán)。另外,請確保您正在關(guān)閉所有@ifwith@endif指令。
@foreach
.
.
.
.
@endforeach

慕標(biāo)5832272
TA貢獻(xiàn)1966條經(jīng)驗 獲得超4個贊
從您的代碼示例看來,您缺少結(jié)束 A 標(biāo)記!
您也不需要使用按鈕和 A 標(biāo)簽。試試這個...
<td>
<a class="btn btn-edit stn-md" href="/post/edit/{{ $post->id_kategori }}"> Edit </a>
</td>
- 2 回答
- 0 關(guān)注
- 140 瀏覽
添加回答
舉報
0/150
提交
取消