donglun1020 2017-01-19 12:10
浏览 93
已采纳

Laravel传递多个变量来查看

Learning through some videos for Laravel but hit an issue i cant seem to figure out.

I have a route

Route::get('/post/{id}/{name}/{password}', 'PostController@showPost');

A custom controller called PostController.php

public function showPost($id, $name, $password) {
        return view('post', compact('id','name','password'));
    }

and the view called post.blade.php

<div class="container">
    <h1>Post {{$id}} {{$name}} {{$password}}</h1>
</div>

when running the url

http://127.0.0.1/post/1/2/3

I get back a 404 page.

  • 写回答

1条回答 默认 最新

  • dousongqiang2585 2017-01-19 12:20
    关注

    Looks like you need to allow .htaccess files. The problem is your routes aren't working.

    https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?