如何在菜单中提供链接进入菜单页面(laravel 4.2)

时间:2018-02-24 05:08:21

标签: php laravel laravel-5 laravel-4

Hello Friend感谢您查看我的问题!!

我无法激活菜单链接

我的查看文件代码

<div class="sign-up-right">
    <a href="{{ URL::route('singup') }}">Sign Up</a>
</div>

我的控制器文件(MyCon.php)

public function singup(){
    return View::make('preview',['preview'=>'signup.php']);
}

我的路线文件代码

Route::get('/', 'MyCon@index');
route::get('admin', array('user'=>'Admin@index'));

Route::get('/login',function(){ return View::make('preview',['preview'=>'login.php']);});

Route::get('singup', ['as' => 'signup', 'uses' => 'MyCon@signup']);

但是当我点击Signup链接时显示错误

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException



    return new Response('', 200, array('Allow' => implode(',', $others)));
        }))->bind($request);
    }
    $this->methodNotAllowed($others);
}

protected function methodNotAllowed(array $others)
{
    throw new MethodNotAllowedHttpException($others);
}

protected function check(array $routes, $request, $includingMethod = true)

请帮助我的链接成功 感谢

2 个答案:

答案 0 :(得分:0)

尝试将路线命名为可以解决您的问题

Route::post('singup', function(){ return View::make('preview',['preview'=>'signup.php']);});

答案 1 :(得分:0)

由于您使用简单的a href链接,因此您需要将路线更改为Route::get

Route::get('singup', ['as' => 'signup', 'uses' => 'MyCon@signup']);

另外,修复链接:

<a href="{{{ URL::route('signup') }}}">Sign Up</a>