我已将公共文件夹中的文件上传到public_html,其他人则上传到laravel。
我也改变了index.php。
但我一无所获......
[
我明白了...... 有人能帮帮我吗? 感谢
编辑: 这是我的索引文件,我认为这很好
<?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 nice to relax.
|
*/
require __DIR__.'/../laravel/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__.'/../laravel/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);
答案 0 :(得分:1)
这个问题很老,但其他人可能觉得这个答案很有用。基本上,您需要将App配置为在新环境中正常工作。
转到 000webhost cPanel&gt;设置&gt;一般&gt;重置网站。您必须确保您的网站中没有其他内容以防止干扰。
以ZIP格式存档整个Laravel项目。
使用File Manager将存档上传到000webhost网站/public_html
。
将与package.json
位于同一级别的所有文件/文件夹移至/
删除/public_html
。你不再需要了它。
将/public
重命名为/public_html
以/app/Providers/AppServiceProvider.php
方式转到register()
并在其中附加以下代码:
$this -> app -> bind('path.public', function()
{
return base_path('public_html');
});
打开/.env
。复制APP_KEY
值,不用 base64:
转到/config/app.php
,找到&#39; key
&#39;并使用以下代码替换该行:
'key' => env('APP_KEY', base64_decode('%YOUR_COPIED_APPKEY%'));
如果您的项目已连接到数据库,请从/config/database.php
更新数据库凭据。查找mysql
向量并正确更新数据库,用户名和密码。
......这应该可以解决问题。如果您还有其他问题,请在此处编写有关整个过程的教程:https://www.000webhost.com/forum/t/deploy-laravel-project-into-000webhost-site/127323/
希望这会有所帮助:)
答案 1 :(得分:0)
写您的index.php
$app->bind('path.public', function() {
return __DIR__ ;
});