如何从根目录而不是公共目录运行 Laravel? [英] How to run Laravel from root directory, not from public?

查看:27
本文介绍了如何从根目录而不是公共目录运行 Laravel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,Laravel 项目是从公共目录运行的,为此我必须输入如下 URL:

By default, Laravel project is run from public directory, for this I must enter URL like as:

http://localhost/public/

如何配置 Laravel 网站将出现在:http://localhost/?

How to configure Laravel that website will be appeared from: http://localhost/?

推荐答案

•转到mainproject/public>>

•Go to mainproject/public>>

a.  .htacess
b.  favicon.ico
c.  index.php
d.  robots.txt
e.  web.config

1.从公用文件夹中剪切这5个文件,然后粘贴到公用文件夹外的主项目文件夹... mainproject/files

1.cut these 5 files from the public folder, and then paste on the main project folder that’s means out side of public folder… mainproject/files

2.下一步粘贴后,打开index.php,修改

2.Next after paste ,open index.php ,modify

•require __DIR__.'/…/bootstrap/autoload.php';  to
•require __DIR__.'/bootstrap/autoload.php';

  1. 修改

$app = require_once DIR.'/../bootstrap/app.php';

$app = require_once DIR.'/../bootstrap/app.php'; to

$app = require_once DIR.'/bootstrap/app.php';

$app = require_once DIR.'/bootstrap/app.php';

您也可以观看此视频以更好地理解----------------

you can also watch this video for better understanding----------------

https://www.youtube.com/watch?v=GboCYqEbKN0

这篇关于如何从根目录而不是公共目录运行 Laravel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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