Home > php教程 > php手册 > body text

php的dl函数用法实例

WBOY
Release: 2016-06-06 20:18:36
Original
1706 people have browsed it

这篇文章主要介绍了php的dl函数用法,以实例形式讲述了利用dl函数突破PHP设置上的限制,是非常实用的技巧,需要的朋友可以参考下

本文实例讲述了php的dl函数用法。分享给大家供大家参考。具体如下:


PHP的dl函数官网说明如下:

具体用法示例如下:

复制代码 代码如下:

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


这样只要php.ini中配置好就可以不要再引用so文件不然会说多处引用

复制代码 代码如下:

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
;extension=memcache.so

希望本文所述对大家的PHP程序设计有所帮助。

Related labels:
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 Recommendations
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!