使用laravel/installer创建新应用仅显示文件结构而不显示网站 [英] Creating new app with laravel/installer shows just file structure not website
问题描述
我只是决定开始学习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屋!