我的项目名称是yadavarpro
。如何在插件域中安装laravel
我在public_html
后面创建了一个yadavarpro
文件夹,我复制了除public
以外的所有文件夹。
(我不能上传StackOverflow上的形象!)
这样的形象:
我创造了另一个yadavarpro
文件夹内public_html
和复制public
文件夹中的所有内容。
这样的形象:
,但我的网站显示白屏。我想我应该改变bootstrap配置。 但我不知道。
我的项目名称是yadavarpro
。如何在插件域中安装laravel
我在public_html
后面创建了一个yadavarpro
文件夹,我复制了除public
以外的所有文件夹。
(我不能上传StackOverflow上的形象!)
这样的形象:
我创造了另一个yadavarpro
文件夹内public_html
和复制public
文件夹中的所有内容。
这样的形象:
,但我的网站显示白屏。我想我应该改变bootstrap配置。 但我不知道。
我解决了:
编辑index.php
内public_html/yadavarpro
:代替
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <[email protected]>
*/
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/
require __DIR__.'/../../yadavarpro/bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../../yadavarpro/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
:
使用
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <[email protected]>
*/
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/
require __DIR__.'/../bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
你一定需要公共目录和所有它的内容。只要addon域指向公共laravel目录,那么它应该可以正常工作。
是什么是指“公共目录”? 'public_html'或'public'文件夹?我应该将我的'public'文件夹的所有内容复制到'public_html'? –
我的意思是laravel应用程序中的公共目录。您可能最终将删除public_html并将该域的webroot指向public /。 – btl
你在做什么是非常正统的,但你可能会欺骗laravel接受它(可能不是值得尝试)。
我将把2个重要的文件laravel引导过程:在index和索引的app bootstrapper
基本上有一个2个引用__DIR__."../bootstrap"
(一个用于自动加载机,一个用于应用程序),你需要改变以找到实际的引导程序位置。在您当前的结构中,如果我理解正确,那可能是:__DIR__."../yadavarpro/bootstrap"
。
在应用程序中的引导程序,你需要做的:
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
$app->instance("path.public",__DIR__."../../public_html"); //Basically overwrite the public path with whatever the correct one is.
这是假设谁需要得到公共路径,他们将始终通过public_path
或app()->make("path.public")
得到它,从来没有认为它只是base_path("public")
但它不可能这个假设在Laravel的任何部分或任何模块中都不会被提出。
你有公共文件夹的所有内容直接拷贝到您的public_html文件夹包括.htaccess –