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程序设计有所帮助。
dl() is not supported in multithreaded Web servers.
貌似,是不支持多线程。。
1.需要加载php扩展
dl("php_w32api.dll");
2.从你的dll里面导出函数,假定该函数在dll里面被声明为FuncDll,并且返回值是int类型
w32api_register_function("函数所在的dll",
"FuncDll",
"int");
3.好了,现在你可以调用它了
$result = FuncDll();

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

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
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version
Chinese version, very easy to use

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
