PHP slim的数据库会话

我正在尝试使用PHP slim框架将我的会话连接到数据库但我似乎无法连接。 我使用以下中间件: https://github.com/yusukezzz/slim-session-manager < / a> </ p>

但该示例显示了如下连接:</ p>

  $ manager-&gt; setDbConnection(Eloquent :: getConnection())  ; 
</ code> </ pre>

我没有使用Eloquent。 我试过了:</ p>

  $ manager-&gt; setDbConnection(mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_DATABASE)); 
</ code> </ pre>
\ n

但是得到错误:</ p>

 参数1传递给Illuminate \ Session \ DatabaseSessionHandler :: __ construct()必须是Illuminate \ Database \ Connection的实例,实例 mysqli给出
</ code> </ pre>

如何传递Illuminate \ Database \ Connection的实例?</ p>
</ div>

展开原文

原文

I am trying to connect my sessions to a database with the PHP slim framework but I cant seem to connect. I am using the following middleware: https://github.com/yusukezzz/slim-session-manager

But the example shows the connection like:

$manager->setDbConnection(Eloquent::getConnection());

I am not using Eloquent. I have tried:

$manager->setDbConnection(mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE));

But get the error:

Argument 1 passed to Illuminate\Session\DatabaseSessionHandler::__construct() must be an instance of Illuminate\Database\Connection, instance of mysqli given

How can I pass an instance of Illuminate\Database\Connection ?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问