Home > Backend Development > PHP Tutorial > PHP函数extension_loaded()用法实例_php技巧

PHP函数extension_loaded()用法实例_php技巧

WBOY
Release: 2016-05-16 20:25:37
Original
1149 people have browsed it

本文实例讲述了PHP函数extension_loaded()用法。分享给大家供大家参考。具体分析如下:

extension_loaded — 检查一个扩展是否已经加载

例如:

复制代码 代码如下:
if (!extension_loaded('gd')) {
    if (!dl('gd.so')) {
        exit;
    }
}
?>

上述代码判断是否加载 gd 库扩展。

补充:

查看php已开启扩展的方法:

命令行cmd界面:

输入:php -m
显示结果如下:

复制代码 代码如下:
[PHP Modules]
bcmath
bz2
calendar
com_dotnet
ctype
curl
date
dom
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mcrypt
mysql
mysqli
odbc
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
Reflection
session
SimpleXML
sockets
SPL
SQLite
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend Optimizer
zip

[Zend Modules]

希望本文所述对大家的php程序设计有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template