如何在插件域中安装laravel

时间:2017-06-16 15:05:12

标签: php mysql laravel laravel-5

我的项目名称为yadavarpro

我在yadavarpro后面创建了一个public_html文件夹,我复制了除public以外的所有文件夹。

(我无法在StackOverflow上传图像!)

喜欢这张图片:

http://yadavarpro.com/1.JPG

我在yadavarpro中创建了另一个public_html文件夹,并复制了public文件夹的所有内容。

喜欢这张图片:

http://yadavarpro.com/2.JPG

但我的网站显示白屏。我想我应该改变bootstrap configure。 但我不知道。

http://yadavarpro.com/

3 个答案:

答案 0 :(得分:1)

我解决了:

index.php内修改public_html/yadavarpro

使用:

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */

/*
|--------------------------------------------------------------------------
| 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 <taylor@laravel.com>
 */

/*
|--------------------------------------------------------------------------
| 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);

答案 1 :(得分:0)

您肯定需要公共目录及其所有内容。只要插件域指向公共laravel目录,它就可以正常工作。

答案 2 :(得分:0)

你在做什么是非常不正统的,但你可能会欺骗laravel接受它(可能不值得尝试)。

我将在laravel启动过程中引用2个重要文件:indexapp bootstrapper

索引中基本上有2个引用__DIR__."../bootstrap"(一个用于自动加载器,一个用于应用程序),您需要更改它以查找实际的引导位置。在您当前的结构中,如果我理解正确,可能是__DIR__."../yadavarpro/bootstrap"

在app bootstrapper中你需要做:

$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_pathapp()->make("path.public")获取它,并且从不认为它只是base_path("public")但是这种假设不可能永远不会在Laravel的任何部分或任何模块中都要小心。