php extension check and load

巴扎黑
Release: 2016-11-29 11:56:07
Original
896 people have browsed it

<?php
/**
 *列出所有加载的扩展及其包含的函数
 */
$exts = get_loaded_extensions();
foreach ($exts as $ext) {
    $funs = get_extension_funcs($ext);
    echo "当前扩展名称:" . $ext . "及其包含的函数<br>";
    foreach ($funs as $fun) {
        echo "<li>$fun</li>";
    }
}
// Example loading an extension based on OS  
if (!extension_loaded(&#39;sqlite&#39;)) {
    if (strtoupper(substr(PHP_OS, 0, 3)) === &#39;WIN&#39;) {
        dl(&#39;php_sqlite.dll&#39;);
    } else {
        dl(&#39;sqlite.so&#39;);
    }
}
// Or, the PHP_SHLIB_SUFFIX constant is available as of PHP 4.3.0  
if (!extension_loaded(&#39;sqlite&#39;)) {
    $prefix = (PHP_SHLIB_SUFFIX === &#39;dll&#39;) ? &#39;php_&#39; : &#39;&#39;;
    dl($prefix . &#39;sqlite.&#39; . PHP_SHLIB_SUFFIX);
}
?>
Copy after login

Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!