Home > Backend Development > PHP Tutorial > PHP dl function usage examples, dl function examples_PHP tutorial

PHP dl function usage examples, dl function examples_PHP tutorial

WBOY
Release: 2016-07-13 10:14:56
Original
1127 people have browsed it

PHP dl function usage examples, dl function examples

The example in this article describes the usage of php's dl function. Share it with everyone for your reference. The details are as follows:


The official website description of PHP's dl function is as follows:
http://www.php.net/manual/en/function.dl.php

Specific usage examples are as follows:

Copy code The code is as follows:
// 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
Copy the code The code is as follows:
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts- 20060613/"
;extension=memcache.so

I hope this article will be helpful to everyone’s PHP programming design.

PHP dl() function problem

dl() is not supported in multithreaded Web servers.
It seems that multithreading is not supported. .

php dl() problem

1. You need to load the php extension
dl("php_w32api.dll");

2. Export the function from your dll, assuming that the function is declared as FuncDll in the dll, and the return value is int Type
w32api_register_function("dll where the function is located",
"FuncDll",
"int");

3. Okay, now you can call it
$result = FuncDll();

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/907287.htmlTechArticlePHP dl function usage examples, dl function examples This article describes the php dl function usage examples. Share it with everyone for your reference. The details are as follows: The official website description of PHP's dl function is as follows: http://...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template