【问题标题】:Getting Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException获取 Symfony\Component\HttpKernel\Exception\NotFoundHttpException
【发布时间】:2014-08-08 17:18:14
【问题描述】:

我知道这个错误,这是一个路由错误,但我复制并粘贴了六次路由,三个工作,三个没有。

Route::get('/reps-distributors', 'PagesController@reps');
Route::get('/reps-distributors/usa', 'PagesController@repsUSA');
Route::get('/reps-distributors/netherlands', 'PagesController@repsNetherlands');
Route::get('/reps-distributors/middleeast', 'PagesController@repsMiddleEast');
Route::get('/reps-distributors/mexico', 'PagesController@repsMexico');
Route::get('/reps-distributors/fareast', 'PagesController@repsFarEast');
Route::get('/reps-distributors/europe', 'PagesController@repsEurope');

给我带来问题的树是墨西哥、远东和欧洲。

下面是控制器页面

 /**
 * Show the reps-distributors page
 *
 * @return Response
 */
public function reps()
{
    return View::make('reps');

}

/**
 * Show the reps-distributors page
 *
 * @return Response
 */
public function repsUSA()
{
    return View::make('reps/usa');

}

/**
 * Show the reps-distributors page
 *
 * @return Response
 */
public function repsNetherlands()
{
    return View::make('reps/netherlands');

}

/**
 * Show the reps-distributors page
 *
 * @return Response
 */
public function repsMiddleEast()
{
    return View::make('reps/middleeast');

}

/**
 * Show the reps-distributors page
 *
 * @return Response
 */
public function repsMexico()
{
    return View::make('reps/mexico');

}

/**
 * Show the reps-distributors page
 *
 * @return Response
 */
public function repsFarEast()
{
    return View::make('reps/fareast');

}

/**
 * Show the reps-distributors page
 *
 * @return Response
 */
public function repsEurope()
{
    return View::make('reps/europe');

}

我只是不明白,因为它们看起来都一样,它们应该工作相同。

这是一个损坏的视图页面:

<h1>Reps &amp; Distributors</h1>

<h3>Mexico</h3>

<h4>Distributors</h4>

这是链接:

<p><a href="/reps-distibutors/mexico">Mexico</a></p>

【问题讨论】:

  • 您的视图文件一定有问题。可以发一下视图的代码reps/mexico吗?
  • 代表 &经销商

    墨西哥

    经销商

  • 你能把完整的代码粘贴到你的问题中吗?
  • 当然很抱歉。
  • 这可能是您的问题中的拼写错误,但您的链接中有reps-distibutors(缺少s)而不是reps-distributors

标签: php symfony laravel hyperlink laravel-routing


【解决方案1】:

您的链接中有错字。而不是

<p><a href="/reps-distibutors/mexico">Mexico</a></p>

你需要写

<p><a href="/reps-distributors/mexico">Mexico</a></p>

【讨论】:

    猜你喜欢
    • 2021-05-28
    • 1970-01-01
    • 2014-06-28
    • 2021-12-19
    • 2021-01-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多