dongxinpa3101 2019-01-08 10:11
浏览 319
已采纳

PDOConnection.php第24行Laravel 5.3中的FatalThrowableError

I have the message when trying login. Everything was fine yesterdey. I checked my connection to a database and checked MySQL server it's worked.

FatalThrowableError in PDOConnection.php line 24:
Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)

in PDOConnection.php line 24
at Composer\Autoload\includeFile('/var/www/html/vendor/composer/../doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php') in ClassLoader.php line 322
at ClassLoader->loadClass('Doctrine\DBAL\Driver\PDOConnection')
at spl_autoload_call('Doctrine\DBAL\Driver\PDOConnection')
at class_exists('Doctrine\DBAL\Driver\PDOConnection') in Connector.php line 115
at Connector->createPdoConnection('mysql:host=127.0.0.1;port=3306;dbname=fuckerbot', 'root', '****', array('0', '2', '0', false, false)) in Connector.php line 56
at Connector->createConnection('mysql:host=127.0.0.1;port=3306;dbname=fuckerbot', array('driver' => 'mysql', 'host' => '127.0.0.1', 'port' => '3306', 'database' => 'fuckerbot', 'username' => 'root', 'password' => '*****', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => false, 'engine' => null, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 24
at MySqlConnector->connect(array('driver' => 'mysql', 'host' => '127.0.0.1', 'port' => '3306', 'database' => 'fuckerbot', 'username' => 'root', 'password' => '*****', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => false, 'engine' => null, 'name' => 'mysql')) in ConnectionFactory.php line 126
at ConnectionFactory->Illuminate\Database\Connectors\{closure}()
at call_user_func(object(Closure)) in Connection.php line 965
at Connection->getPdo() in Connection.php line 986
at Connection->getReadPdo() in Connection.php line 423
at Connection->getPdoForSelect(true) in Connection.php line 333
at Connection->Illuminate\Database\{closure}(object(MySqlConnection), 'select * from `users` where `email` = ? limit 1', array('admin@admin.ru')) in Connection.php line 763
at Connection->runQueryCallback('select * from `users` where `email` = ? limit 1', array('admin@admin.ru'), object(Closure)) in Connection.php line 726
at Connection->run('select * from `users` where `email` = ? limit 1', array('admin@admin.ru'), object(Closure)) in Connection.php line 351
at Connection->select('select * from `users` where `email` = ? limit 1', array('admin@admin.ru'), true) in Builder.php line 1648
at Builder->runSelect() in Builder.php line 1634
at Builder->get(array('*')) in Builder.php line 638
at Builder->getModels(array('*')) in Builder.php line 327
at Builder->get(array('*')) in Builder.php line 297
at Builder->first() in EloquentUserProvider.php line 104
at EloquentUserProvider->retrieveByCredentials(array('email' => 'admin@admin.ru', 'password' => '*****')) in SessionGuard.php line 353
at SessionGuard->attempt(array('email' => 'admin@admin.ru', 'password' => '*******'), false) in AuthenticatesUsers.php line 76
at LoginController->attemptLogin(object(Request)) in AuthenticatesUsers.php line 42
at LoginController->login(object(Request))
at call_user_func_array(array(object(LoginController), 'login'), array(object(Request))) in Controller.php line 55
at Controller->callAction('login', array(object(Request))) in ControllerDispatcher.php line 44
at ControllerDispatcher->dispatch(object(Route), object(LoginController), 'login') in Route.php line 189
at Route->runController() in Route.php line 144
at Route->run(object(Request)) in Router.php line 653
at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in RedirectIfAuthenticated.php line 24
at RedirectIfAuthenticated->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 65
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
at Pipeline->then(object(Closure)) in Router.php line 655
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 629
at Router->dispatchToRoute(object(Request)) in Router.php line 607
at Router->dispatch(object(Request)) in Kernel.php line 268
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
at Pipeline->then(object(Closure)) in Kernel.php line 150
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117
at Kernel->handle(object(Request)) in index.php line 53

It's all stack trace from the error message. I not found and points from my code. One moment on the local system it's project work correctly. But a remote server has the error.

  • 写回答

2条回答 默认 最新

  • dsyrdwdbo47282676 2019-01-08 19:48
    关注

    The error is happening at this line:

    public function __construct($dsn, $user = null, $password = null, ?array $options = null)
    

    Specifically at the question mark ? before array $options.

    This is a new feature that was introduced in PHP v7.1 called Nullable types.

    You must be on version 7.1 or higher for this error to go away.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 商城生产日期批次库存问题
  • ¥15 esp8266控制共阳极wrgb灯板无法关闭所有led灯
  • ¥100 python读取速度问题
  • ¥15 stm32f407使用DMA问题
  • ¥15 您好 这个API接口该怎么弄 网站搭建好了 API也有 现在就不知道该怎么填写API 不知道怎么用
  • ¥88 用uniapp写一个多端的程序,用到高德地图,用高德的JSAPI吗?
  • ¥20 关于#c++#的问题:水果店管理系统
  • ¥30 dbLinq最新版linq sqlite
  • ¥20 对D盘进行分盘之前没有将visual studio2022卸载掉,现在该如何下载回来
  • ¥15 完成虚拟机环境配置,还有安装kettle