如何在没有 Artisan 的情况下运行 Laravel? [英] How to run Laravel without Artisan?

查看:66
本文介绍了如何在没有 Artisan 的情况下运行 Laravel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 PHP 和 Apache2,我想在没有 Artisan 的情况下运行 Laravel 框架,但我不能!有谁知道如何在没有 Artisan 的情况下运行 Laravel?

I have PHP with Apache2 and I want to run Laravel Framework without Artisan but I can't! Does anyone know how to run Laravel without Artisan?

推荐答案

我已经解决了这个问题.问题出在我的 htaccess 和 mod_rewrite (Apache2) 中.现在我只能通过输入 localhost/public.. 来连接到我的应用程序.

I've solved the problem. The problem was in my htaccess and in mod_rewrite (Apache2). Now I can connect to my application only by typing localhost/public..

如果有人想公开应用程序,更简单快捷的方法是:

If anyone wants to make the application public, the more easy and fastest way is:

  • 将根目录中的server.php"文件重命名为index.php"
  • 将您的 .htaccess 从公共文件夹移动到根目录
  • 使 Apache2 可以访问您的目录(设置正确的文件/文件夹权限).

感谢所有用户的帮助!:)

Thanks to all users for help! :)

重要修改

考虑使用 Apache 虚拟主机(将虚拟主机指向/public Laravel 文件夹)而不是将 server.php 重命名为 index.php 因为这样做你需要在视图中使用 Laravel 的 asset() 函数时添加前缀public/".

Consider using Apache Virtual Hosts (pointing the virtual host to the /public Laravel folder) instead of renaming server.php to index.php because by doing this you will need to prefix "public/" when you use the Laravel's asset() function in your views.

与使用不同配置的其他开发人员合作时,这可能是一个大问题,因为他们将能够看到资产,而您看不到(反之亦然).

When working with other devs, who are using a different configuration, this might be a big problem because they will be able to see the assets while you will not (or viceversa).

这篇关于如何在没有 Artisan 的情况下运行 Laravel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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