Laravel Installation shows blank page. Error:unexpected T_STRING

Laravel Installation shows blank page. Error:unexpected T_STRING

我正在尝试在主机中上传我的 laravel 项目。但是当我点击 url 时,它给出了一个空白页。当我检查错误日志时,它显示以下错误:

[23-Jan-2018 23:01:35] PHP Warning:  Unexpected character in input:  '\' (ASCII=92) state=1 in /home4/knownepa/public_html/tra/index.php on line 51
[23-Jan-2018 23:01:35] PHP Parse error:  syntax error, unexpected T_STRING in /home4/knownepa/public_html/tra/index.php on line 51

我在这些行中有以下代码行:

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

谁能帮帮我?

问题出在您的 PHP 版本上。

您的 PHP 版本应高于 5.2,因为 PHP 5.2 及以下版本不支持命名空间。

事实上,Laravel 5.5需要PHP7.0及以上。

Laravel requirements

但是由于你的Laravel版本是5.2,从Laravel 5.2docs

您的 PHP 版本应至少为 5.5.9 或更高版本。

所以我建议您更新到最新版本 PHP 以避免此类问题。