首页 >后端开发 >php教程 > php 扩充检查并加载

php 扩充检查并加载

WBOY
WBOY原创
2016-06-13 13:08:151009浏览

php 扩展检查并加载

<?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 ( '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 );
}
?> 

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn