测试 pdo 的 php 代码是否可用? [英] php code to test pdo is available?
本文介绍了测试 pdo 的 php 代码是否可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用 PDO 但我不确定我的托管已正确设置.
I want to use PDO but I'm not sure whether my hosting has set it up properly.
如何在 PHP 中测试它是否已安装并适用于 MySQL?
How can I test, in PHP, whether it is setup and working for MySQL?
推荐答案
除了使用 phpinfo() 查看是否正确列出
Aside from using phpinfo() to see if it's correctly listed
if (!defined('PDO::ATTR_DRIVER_NAME')) {
echo 'PDO unavailable';
}
这篇关于测试 pdo 的 php 代码是否可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文