如何从根目录而不是从公共目录运行Laravel?

编程入门 行业动态 更新时间:2024-10-26 19:37:38
本文介绍了如何从根目录而不是从公共目录运行Laravel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

localhost/public/

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

How to configure Laravel that website will be appeared from: 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';

  • 修改

  • modify

    $ 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----------------

    www.youtube/watch?v=GboCYqEbKN0

  • 更多推荐

    如何从根目录而不是从公共目录运行Laravel?

    本文发布于:2023-08-02 11:50:28,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1277570.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:是从   而不   根目录   目录   Laravel

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!