估计是你的PHP初始化文件没有设置,你可以参照手册里对dl()的说明,比方:/***
The directory where the extension is loaded from depends on your platform: Windows - If not explicitly set in the php.ini, the extension is loaded from c:\php4\extensions\ by default. Unix - If not explicitly set in the php.ini, the default extension directory depends on
whether PHP has been built with --enable-debug or not whether PHP has been built with (experimental) ZTS (Zend Thread Safety) support or not the current internal ZEND_MODULE_API_NO (Zend internal module API number, which is basically the date on which a major module API change happened, e.g. 20010901) Taking into account the above, the directory then defaults to <install-dir>/lib/php/extensions/ <debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO, e.g. /usr/local/php/lib/php/extensions/debug-non-zts-20010901 or /usr/local/php/lib/php/extensions/no-debug-zts-20010901. 注: dl() is not supported in multithreaded Web servers. Use the extensions statement in your php.ini when operating under such an environment. However, the CGI and CLI build are not affected ! 注: dl() is case sensitive on Unix platforms. */
The directory where the extension is loaded from depends on your platform: Windows - If not explicitly set in the php.ini, the extension is loaded from c:\php4\extensions\ by default. Unix - If not explicitly set in the php.ini, the default extension directory depends on
whether PHP has been built with --enable-debug or not whether PHP has been built with (experimental) ZTS (Zend Thread Safety) support or not the current internal ZEND_MODULE_API_NO (Zend internal module API number, which is basically the date on which a major module API change happened, e.g. 20010901) Taking into account the above, the directory then defaults to <install-dir>/lib/php/extensions/ <debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO, e.g. /usr/local/php/lib/php/extensions/debug-non-zts-20010901 or /usr/local/php/lib/php/extensions/no-debug-zts-20010901. 注: dl() is not supported in multithreaded Web servers. Use the extensions statement in your php.ini when operating under such an environment. However, the CGI and CLI build are not affected ! 注: dl() is case sensitive on Unix platforms. */
the CGI and CLI build are not affected ! 这句话是指CGI模式不受影响还是CGI模式无效(无法调用dl()? )??
1、可以php可以调用第三方的DLL
2、但第三方的DLL必须使用COM接口编写(不知道这样表达对不对,因为我还没有使用过COM编程)
3、第三方的DLL必须使用regsvr32进行注册才能被调用,并且DLL文件要复制到system32 和 php/extensions目录下,要在PHP.INI里面加入extension=mydll.dll
4、调用的语句为:
<?php
dl('mydll.dll'); //dl()函数据说在PHP6以后就不能使用了
$api = new win32;
$api->registerfunction("int plus(int x,int y) From mydll.dll");//一个加法运算
$sum=$api->plus(1,2);
echo $sum; //结果应该为3
?>
5、PHP必须以CGI模式加载有没有错误和遗漏的,请大家帮忙看看。