php extension check and load

巴扎黑
Release: 2016-11-24 15:38:50
Original
1563 people have browsed it

/**

*List all loaded extensions and the functions they contain

*/

$exts = get_loaded_extensions();

foreach ($exts as $ext) {

    $funs = get_extension_funcs($ext);

    echo "当前扩展名称:" . $ext . "及其包含的函数
";

    foreach ($funs as $fun) {

        echo "

  • $fun
  • ";

        }

    }

    // Example loading an extension based on OS  

    if (!extension_loaded('sqlite')) {

        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {

            dl('php_sqlite.dll');

        } else {

            dl('sqlite.so');

        }

    }


    // Or, the PHP_SHLIB_SUFFIX constant is available as of PHP 4.3.0  

    if (!extension_loaded('sqlite')) {

        $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';

        dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX);

    }

    ?> 


    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