我有一个 php库 https://github.com/tedivm/Fetch,它使用Fetch命名空间,我想在我的脚本中检查它是否存在。
我的脚本代码:
// Load Fetch
spl_autoload_register(function ($class) {
$file = __DIR__ . '/vendor/' . strtr($class, '\\', '/') . '.php';
if (file_exists($file)) {
require $file;
return true;
}
});
if (!class_exists('\\Fetch')) {
exit('Failed to load the library: Fetch');
}
$mail = new \Fetch\Server($server, $port);
但是这个消息总是出现。但是该库完全可以使用。
感谢您提前的任何帮助!