search
Homephp教程php手册php的dl函数用法实例,dl函数实例

php的dl函数用法实例,dl函数实例

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


PHP的dl函数官网说明如下:
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");


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

复制代码 代码如下:

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

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

PHP dl()函数问题

dl() is not supported in multithreaded Web servers.
貌似,是不支持多线程。。
 

php dl()问题

1.需要加载php扩展
dl("php_w32api.dll");

2.从你的dll里面导出函数,假定该函数在dll里面被声明为FuncDll,并且返回值是int类型
w32api_register_function("函数所在的dll",
"FuncDll",
"int");

3.好了,现在你可以调用它了
$result = FuncDll();
 

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function