laravel 4 在 Windows XAMPP 上不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18668734/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 08:23:41  来源:igfitidea点击:

laravel 4 does not work on Windows XAMPP

phpwindows-7laravelxampplaravel-4

提问by SaidbakR

On Windows 7 cmd I have run composer create-project laravel/laravel blog --prefer-distfrom `C:\xampp\htdocs\lara. Everything is downloaded and installed fine.

在 Windows 7 cmd 上,我composer create-project laravel/laravel blog --prefer-dist从`C:\xampp\htdocs\lara 运行。一切都已下载并安装正常。

However, when I try to access http://localhost/lara/blogit shows the directory listing of apache. I followed the instruction in the documentationduring the installation.

但是,当我尝试访问http://localhost/lara/blog它时,它显示了 apache 的目录列表。我在安装过程中按照文档中的说明进行操作。

I noticed the following notes:

我注意到以下注释:

  1. C:\xampp\htdocs\lara\blogdoes not has any index.php or .htaccess
  2. C:\xampp\htdocs\lara\blog\appalso, does not has any index.php or .htaccess
  3. Only accessing http://localhost/lara/blog/publicopens a page with the laravel logo and the words "You have arrived"
  1. C:\xampp\htdocs\lara\blog没有任何 index.php 或 .htaccess
  2. C:\xampp\htdocs\lara\blog\app此外,没有任何 index.php 或 .htaccess
  3. 仅访问会http://localhost/lara/blog/public打开带有 Laravel 徽标和“您已到达”字样的页面

I could not able to know what's the problem?

我不知道有什么问题?

回答by Aken Roberts

Laravel's folder structure uses the publicfolder as the WWW root, effectively placing all your application's files outsideof the web root to help keep them secure. What you are experiencing is normal.

Laravel 的文件夹结构使用该public文件夹作为 WWW 根目录,有效地将所有应用程序文件放在Web 根目录之外以帮助确保它们的安全。你遇到的情况是正常的。

You'll have to either access your application from the http://localhost/lara/blog/publicURL, or set up a virtual host URL (e.g. http://testblog.dev) that is pointed to the public folder. I do not develop on Windows/XAMPP so I cannot specifically tell you how to do that part.

您必须从http://localhost/lara/blog/publicURL访问您的应用程序,或者设置一个http://testblog.dev指向公共文件夹的虚拟主机 URL(例如)。我不在 Windows/XAMPP 上开发,所以我不能具体告诉你如何做那部分。

回答by Faramarz Salehpour

If you're running php > 5.4 you can serve the app using the builtin server from command prompt as well (for development purposes):

如果您正在运行 php > 5.4,您也可以从命令提示符使用内置服务器为应用程序提供服务(用于开发目的):

php artisan serve

php artisan serve

回答by Iapilgrim

I have an answer on How to install Laravel via Laravel Installer on Windows?

我有关于如何在 Windows 上通过 Laravel 安装程序安装 Laravel的答案

or

或者

http://goo.gl/uftcSofor more details

http://goo.gl/uftcSo了解更多详情

Hope that helps.

希望有帮助。