Home  >  Article  >  Backend Development  >  php dl function_PHP tutorial

php dl function_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:46:521291browse

http://www.php.net/manual/en/function.dl.php

// 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);

}

?>

dl("memcache.so");

In this way, as long as it is configured in php.ini, you can no longer reference the so file, otherwise it will say multiple references

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"

;extension=memcache.so

Author 21aspnet

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478547.htmlTechArticlehttp://www.php.net/manual/en/function.dl.php ?php // Example loading an extension based on OS if (!extension_loaded(sqlite)) { if (strtoupper(substr(PHP_OS, 0, 3)) === WIN) { dl(ph...
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