PHP/PDO:如何获取当前连接状态

2022-01-24 00:00:00 connection database-connection php pdo

什么是 PDO 等价物:

What is the PDO equivalent of:

mysqli_stat($dbConn);

附:我用它来(收到消息)确保我已连接

P.S. I use it to (get a message to) make sure I am connected

推荐答案

我不能得到这个答案.有人发布了答案,但他/她后来删除了该条目.

I cannot get credit for this answer. Someone posted the answer, but he/she latter deleted the entry.

这是(已保存存档) 对您问题的回答:

Here's the (saved archived) answer to your question:

$status = $conn->getAttribute(PDO::ATTR_CONNECTION_STATUS);

相关文章