app http routes.php,Laravel:我的应用程序没有被路由(Laravel : My app doesn't get routed)

Laravel:我的应用程序没有被路由(Laravel : My app doesn't get routed)

我正在运行我的第一个laravel应用程序,在接下来的几个小时中遇到依赖项安装错误。

对不起它可能是一个小错误,但似乎我无法找到。

图片较暗,电脑坏了。

NppDqm.png

应用程序/ HTTP / routes.php文件

// view('helloworld') ==> helloworld.blade.php

Route::get('/', function () {

return view('helloworld');

});

资源/视图/ helloworld.blade.php

Yo test....test..

当我点击http://localhost:8000/ ,它会让我(即使刷新后):

7ZSHbm.png

为什么'/'不会被路由? 它是laravel 5,最新的。

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.

NppDqm.png

app/Http/routes.php

// view('helloworld') ==> helloworld.blade.php

Route::get('/', function () {

return view('helloworld');

});

resources/view/helloworld.blade.php

Yo test....test..

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

7ZSHbm.png

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

原文:https://stackoverflow.com/questions/41494569

更新时间:2019-12-04 02:15

最满意答案

在Laravel 5.3中,Http路由文件被切换到routes /目录。

所有Laravel路由都在路由文件中定义,这些路由文件位于routes目录中。 这些文件由框架自动加载。 routes / web.php文件定义了适用于您的Web界面的路由。 这些路由分配了Web中间件组,该组提供会话状态和CSRF保护等功能。 routes / api.php中的路由是无状态的,并被分配了api中间件组。

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

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.

2017-01-05

相关问答

这不是分页,它只是一条路线。 你的路线是这样的: Route::get('/', 'HomeController@showIndex');

Route::get('/about', 'HomeController@showAbout');

Route::get('/portfolio', 'HomeController@showPortfolio');

相应的控制器可能是这样的: class HomeController extends BaseController {

public

...

很久以来我使用Heroku,但文档已经满足您的需求。 你得到的是403,因为很可能你没有设置web root。 默认情况下,Web根目录是/受限制的。 在Laravel你需要它/public 将Procfile添加到Laravel项目的根目录并向其添加以下行: web: vendor/bin/heroku-php-apache2 public/ 问题的第二部分可以通过从终端运行heroku run bash来实现。 您可能需要指定您的应用名称。 但是应该提到的是,下次部署应用程序时,您的更改可能会

...

在Laravel 5.3中,Http路由文件被切换到routes /目录。 https://laravel.com/docs/5.3/routing#basic-routing 所有Laravel路由都在路由文件中定义,这些路由文件位于routes目录中。 这些文件由框架自动加载。 routes / web.php文件定义了适用于您的Web界面的路由。 这些路由分配了Web中间件组,该组提供会话状态和CSRF保护等功能。 routes / api.php中的路由是无状态的,并被分配了api中间件组

...

您可以为每个子域创建路由组,然后对每个组使用“之前”过滤器。 Route::filter('domain1', function($request)

{

$uri = Request::path(); //this might be in $request

$matches = preg_match('^https?:\/\/([a-zA-Z)]+)\./', $uri);

$subdomain = $matches[1];

Session::put('domain

...

使用 :

你得到一个错误,因为你写错了:

Use :

You get an error because you made a typo:

在@Panama_Jack的帮助下,我能够找到正确的方向来解决这个问题。 诀窍是: 我正在运行Laravel并使用php -S 0.0.0.0:80来运行我的开发服务器 PHP的内部服务器不解析.htaccess文件 但是,它确实有一些默认路由。 有一个很大的已知扩展名列表( .js , .css , .mp3等) - 如果请求有这些扩展名之一,它会尝试加载文件。 如果请求没有这些可信扩展之一,则会将其重定向到index.php 但是,您可以使用以下命令运行服务器: php -S 0.0.0.0:

...

根据Laravel官方文件, You may also use the prefix parameter to specify common parameters for your grouped routes:

Route::group(['prefix' => 'accounts/{account_id}'], function () {

Route::get('detail', function ($account_id) {

// Matches The a

...

AuthenticatedFrame是一个功能组件,因此无法访问this关键字,您需要像访问功能参数那样访问道具 export const AuthenticatedFrame = (props) => (

{props.children}

...

我相信你想:

如果您查看浏览器屏幕截图中的网址,您会看到

收益率: https://kidznotes-app-cynthiarios.c9users.io/classrooms#new

但你想要: https://kidznotes-app-

...

您使用的是哪个版本的PHP buildpack? 您可以通过使用-b https://github.com/cloudfoundry/php-buildpack选项推送您的应用程序,尝试使用最新的社区版本。 我知道使用早期版本的buildpack(v3.1.0),您实际上需要在一个文件中指定一个名为COMPOSER_VERSION的特殊属性,该文件与您的应用程序一起推送,名为options.json options.json示例: {

"PHP_EXTENSIONS": [ "bz2", "z

...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值