douxiyi2418 2017-01-05 20:57
浏览 88
已采纳

Laravel:我的应用程序没有被路由

I'm running my first laravel app for the first after hours struggling with dependencies installation errors.

Sorry it might be tiny mistake but seems I couldn't find out.

Picture are darker, computer is being broken.

enter image description here

app/Http/routes.php

<?php

// view('helloworld') ==> helloworld.blade.php
Route::get('/', function () {
   return view('helloworld');
});

resources/view/helloworld.blade.php

<!DOCTYPE html>
<html> 
   <head>
   </head>

   <body>
      <div class = "container">       
         <div class = "content">

         </div>
        <p> Yo test....test..</p>   
      </div>
   </body>

</html>

when I hit http://localhost:8000/, it gaves me (even after refreshing) :

enter image description here

Why doesn't '/' get routed ? It's laravel 5, the latest one.

  • 写回答

3条回答 默认 最新

  • doujia4759 2017-01-05 21:07
    关注

    In Laravel 5.3, the Http routes file was switched to the routes/ directory.

    https://laravel.com/docs/5.3/routing#basic-routing

    All Laravel routes are defined in your route files, which are located in the routes directory. These files are automatically loaded by the framework. The routes/web.php file defines routes that are for your web interface. These routes are assigned the web middleware group, which provides features like session state and CSRF protection. The routes in routes/api.php are stateless and are assigned the api middleware group.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来