【发布时间】:2015-03-20 13:34:18
【问题描述】:
我从https://github.com/jamesiarmes/php-ews下载了PHP ews数据库。
自动加载器:
function __autoload ($className){
preg_match ("/^(([a-zA-Z]{5})_)?(.+)$/",$className,&$treffer); # die ersten 5 Stellen=Verzeichnisname, Weitere Zeichen=Dateiname
if(file_exists(PROJEKT_DIR.$className.".class.php")) include_once(PROJEKT_DIR.$className.".class.php");
else{
$pfad=SCRIPT_DIR."include/";
if($treffer[2]) $pfad.="classes/".$treffer[2]."/";
if(file_exists($pfad.$treffer[3].".class.php"))
include_once($pfad.$treffer[3].".class.php");
elseif(substr($treffer[3],-7)!="_bvstnd" and class_exists($className."_bvstnd")){
eval("class $className extends ".$className."_bvstnd {} ");
}
else{
// Start from the base path and determine the location from the class name,
$pfad=SCRIPT_DIR."include/php-ews";
$include_file = $pfad . '/' . str_replace('_', '/', $className) . '.php';
return (file_exists($include_file) ? require_once $include_file : false);
}
}
#if(file_exists(SCRIPT_DIR."include/".$className.".class.php"))
# include_once(SCRIPT_DIR."include/".$className.".class.php");
}
它还会加载一些其他文件。
然后我开始从他的网站上做指南,我开始这样做:
<?php
$host = "*********";
$username="**********";
$password="***********";
$version= "***********";
$ews = new ExchangeWebServices($host, $username, $password, $version);
$request = new EWSType_FindFolderType();
$request->Traversal = EWSType_FolderQueryTraversalType::SHALLOW;
$request->FolderShape = new EWSType_FolderResponseShapeType();
$request->FolderShape->BaseShape = EWSType_DefaultShapeNamesType::ALL_PROPERTIES;
// configure the view
$request->IndexedPageFolderView = new EWSType_IndexedPageViewType();
$request->IndexedPageFolderView->BasePoint = 'Beginning';
$request->IndexedPageFolderView->Offset = 0;
// set the starting folder as the inbox
$request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::INBOX;
// make the actual call
$response = $ews->FindFolder($request);
?>
起初浏览器上的站点加载时间很长,但随后告诉我这样的信息:class Exception is undefined。我无法说出正确的消息,因为现在如果我加载脚本,这条消息甚至都不会出现。
浏览器只是无限加载。在此之后,我什至无法使用我的 PHP 文件连接到我的服务器。我必须打开我的其他浏览器才能再次连接。
如果我在其他浏览器中打开脚本,那么我可以再次运行该脚本,但它再次加载无穷大。 (我用自动加载器包含了我需要的所有文件,所以这不是问题)
有没有人遇到过这样的问题并找到了解决方案?
【问题讨论】:
-
类似的东西?还是完全一样?我认为这是别的东西,例如该库中的一个例外,因为您没有加载该类而无法找到:我没有看到该链接中提到的自动加载器。尝试添加?
-
我应该在哪里添加什么?什么意思?
-
如果您检查该 github 页面,您会看到一个包含“自动加载”段的操作指南。你已经创建了一个自动加载器,但我没有看到你在调用它。我怀疑这是问题所在,但由于您没有显示实际的错误消息,我无法确定。我怀疑它说明了异常子类,然后我的自动加载器理论将是可行的。因此,您可能希望将自动加载器代码添加到您的 ews 代码中,并且您肯定希望将逐字错误添加到您的问题中。
-
我在开始时包含一个文件,自动加载器每次都被加载。如果我不这样做,脚本甚至不会运行“$ews = new ExchangeWebServices($host, $username, $password, $version); ”。我想写错误消息,但我不能再在浏览器中加载脚本了。如果我再次收到消息,我会尽快发布
-
@Nanne 在我让网站加载超过 5 小时后再次收到错误消息。这里是“类 EWS_Exception 未定义”。但是每个文件都在我的工作区中并且包含在内。 ews_expression.php 也是。我不知道该怎么办。
标签: php browser exchangewebservices exchange-server-2010 php-ews