本文介紹了如何確定在 PHP 中是否啟用了 PDO?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
是否有 PHP 命令可以用來確定 PDO 是啟用還是禁用?
Is there a PHP command I can use to determine if PDO is enabled or disabled?
我知道我手動運行 phpinfo() 并觀察它,但我有一個腳本,我運行各種 Web 服務器,顯示服務器的選定 PHP 配置設置.
I know I an manually run phpinfo() and eyeball it, but I have a script I run various web servers that display selected PHP configuration settings for the server.
所以我想看看是否有我可以使用的命令.
So I am looking to see if there is a command I can use.
推薦答案
檢查類是否存在:
Check if the class exists:
if (class_exists('PDO'))
感謝我仍然得到的支持和所有贊成票,但請查看Salman Abbas 的回答以了解 正確的方法來做到這一點.
I appreciate the support and all the upvotes I still get, but please check Salman Abbas's answer for the proper way to do this.
這篇關于如何確定在 PHP 中是否啟用了 PDO?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!