php code to test pdo is available?

前端 未结 6 1933
夕颜
夕颜 2020-11-29 08:34

I want to use PDO but I\'m not sure whether my hosting has set it up properly.

How can I test, in PHP, whether it is setup and working for MySQL?

6条回答
  •  孤街浪徒
    2020-11-29 08:57

    Aside from using phpinfo() to see if it's correctly listed

    if (!defined('PDO::ATTR_DRIVER_NAME')) {
    echo 'PDO unavailable';
    }
    

提交回复
热议问题