更改 Laravel 8 上的公用文件夹 [英] Changing public folder on Laravel 8

查看:40
本文介绍了更改 Laravel 8 上的公用文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始(重新)学习 Laravel,现在是这个版本 8,并使用运行许多其他 Web 应用程序(运行一些基本内部服务和 API 的服务器机器)的 Apache 服务器 (Xampp) 和正在考虑是否可以将公共文件夹放在 htdocs 上,这样它就可以访问,并且应用程序在它之外.

I've just started (re)learning Laravel, now on this version 8, and working with a Apache Server (Xampp) that runs lots of other web applications (a server machine that run some essential internal services and APIs) and was thinking if it was possible to just put the public folder on the htdocs, so it's accessible, and the application outside of it.

我最近一直在使用 CodeIgniter 4.1.1,这是一个很难学习的部分,但现在做起来相当简单,只需更改 index.php 代码中的一两个引用就完成了,如何完成Laravel 8?

I've been using CodeIgniter 4.1.1 lately and was a tricky part to learn but now is rather simple to do, just changing one or two references inside the index.php code and it's done, how would it be done on Laravel 8?

推荐答案

如果你想把公共文件夹带出项目,你需要改变 index.php 文件中的目录路径:

If you want to bring public folder out of the project than you need to change the dir path inthe index.php file:

来自

   require __DIR__.'/../vendor/autoload.php';
   $app = require_once __DIR__.'/../bootstrap/app.php';

require __DIR__.'/vendor/autoload.php';
   $app = require_once __DIR__.'/bootstrap/app.php';

这篇关于更改 Laravel 8 上的公用文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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