<?php
$DllName = 'MyDLL.dll';
$dllPath = realpath($DllName);
if (file_exists($dllPath)) {
echo " File exists\n";
} else {
echo "no file\n";
}
if (extension_loaded($DllName)) {
echo "DLL file loaded.\n";
} else {
if (file_exists($DllName)) {
if (extension_loaded($DllName)) {
echo $DllName . " file uploaded successfully.\n";
} else {
echo $DllName . " The file could not be loaded.\n";
}
} else {
echo $DllName . " file does not exist!\n";
}
}
$str1 = "Hello"; // first parameter
$str2 = "World"; // second parameter
$result = call_user_func($DllName, 'TrialFunc', $str1, $str2);
echo $result . "\n";
/*
In MyDLL.dll;
function TrialFunc(str1, str2: PChar): PChar; stdcall;
*/
你好,
MyDLL.dll 文件与 .php 文件在同一位置。
在localhost上运行a.php文件时,出现“Failed to load file”的消息。
用 Delphi7 创建的 DLL 文件不能从 PHP 中调用吗?
在此先感谢各位朋友的帮助
享受你的工作。