douyi6922 2014-11-18 07:23
浏览 26

所有路由抛出NotFoundHttpException但回家

I got this code in the routes.php:

Route::get('/', array('as' => 'home', function()
{
    return View::make('list.open');
}));

Route::get('room/{name}', array('as' => 'showRoom', 'uses' => 'RoomController@showRoom'));

Route::post('room', array('as' => 'openRoom', 'uses' => 'RoomController@openRoom'));

And this code in the RoomController.php:

class RoomController extends Controller {

    public function openRoom()
    {
      return "test";
    }

    public function showRoom($name)
    {
      return "test2";
    }
}

If I open public/ it will Show me the view list.open but if I open public/room/test it throw the NotFoundHttpException. (I also tried to use directly a function in the routes.php instead of the roomcontroller but it doesnt worked)

Can anyone help me?

Kind regards Damon

  • 写回答

2条回答 默认 最新

  • dtd58256 2014-11-18 07:33
    关注

    You don't need to add the public folder to your path, you can just go to http://location.com/room/test.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度