Home  >  Article  >  Backend Development  >  Detailed explanation of the use of extension_loaded() function in php

Detailed explanation of the use of extension_loaded() function in php

黄舟
黄舟Original
2017-12-04 11:56:2116155browse

I believe many friends are confused when they see the title. They don’t know much about the usage of php functionextension_loaded(). Today we will introduce to you an example and analyze the function. The specific usage of extension_loaded() to check whether an extension has been loaded, and a supplementary explanation of the method of checking whether the php extension has been loaded on the local machine!

Recommended Manual: php Complete Self-Study Manual

##extension_loaded — Check whether an extension has been loaded

For example:


The code is as follows:

<?php
if (!extension_loaded(&#39;gd&#39;)) {
    if (!dl(&#39;gd.so&#39;)) {
        exit;
    }
}
?>

The above code determines whether to load the gd library extension.

Related video recommendations: 1.
Dugu Jiujian(4)_PHP video tutorial

Supplement:

How to check if php has enabled extensions:

Command line cmd interface:

Input: php -m

Display results As follows:

The code is as follows:

[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]

Summary:

This article introduces the php function extension_loaded() in detail through examples Usage, I believe everyone has a certain understanding of this, I hope it will be helpful to your work!


The above is the detailed content of Detailed explanation of the use of extension_loaded() function in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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