使用laravel/installer创建新应用仅显示文件结构而不显示网站 [英] Creating new app with laravel/installer shows just file structure not website

查看:89
本文介绍了使用laravel/installer创建新应用仅显示文件结构而不显示网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是决定开始学习Laravel.遵循入门对我来说,最简单的解决方案似乎是开始使用laravel安装程序.

所以我所做的就是在全球范围内安装了安装程序,然后仅通过laravel new laravelapi创建了新项目.

在cli准备好之后,我用数据库信息编辑了.env文件,并将APP_URL更改为 http://localhost/laravelapi/(我正在使用XAMPP,而laravelapi是我的项目的名称).不幸的是,当我在该URL上打开浏览器时,我只看到文件,而不是渲染的网站.

有趣的是,当我打开http://localhost/laravelapi/server.php网站时,正确加载了(这只是一些琐碎的laravel默认页面)

我想知道htaccess是否正常工作,我试图检查我的apache是​​否将mod_rewrite作为他已加载的模块之一,但它在那里.

我真的很陌生,很明显我错过了一些重要的事情,但是我在这里与它战斗了几个小时却没有任何结果.有人遇到过这个问题吗?如果是这样,解决方案是什么?

解决方案

Laravel项目的文档根目录是public目录.除非所有请求的文件都存在于public目录(例如资产)之内,否则所有用户请求都应路由到public/index.php.

您可以按照Getting Started most easy solution for me seems to be to start using laravel installer.

So what I did was installed installer globally and then simply created new project via laravel new laravelapi.

After cli prepare it I edited .env file with my database info and changed APP_URL to http://localhost/laravelapi/ (I'm using XAMPP and laravelapi is name of my project). Unfortunately when I opened browser on that URL I just see the files, not a rendered website.

Funny thing is that when i open http://localhost/laravelapi/server.php site load correctly (it's just some trivial laravel default page)

I was wondering if htaccess works correctly I tried to check if my apache has mod_rewrite as one of his loaded module but it was there.

I am really new in it and I obviously missed something important, but I fight here with it for couple hours without any result. Does anyone face this issue before? If so what was the solution?

解决方案

The Document Root for a Laravel project is the public directory. All user requests should be routed to public/index.php unless the file requested exists within the public directory -- e.g: assets.

You can change the document root for an xampp operated project by following the steps provided in this StackOverflow answer.

这篇关于使用laravel/installer创建新应用仅显示文件结构而不显示网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆