douchuanchai2793 2017-03-10 13:07
浏览 30

在cakephp 3控制器中包含类

I am trying to load some classes with the USE tag into my PagesController.

I have this currently:

use ExchangeWebServices;

use EWSType_FindItemType;

use EWSType_ItemQueryTraversalType;
use EWSType_ItemResponseShapeType;
use EWSType_DefaultShapeNamesType;
use EWSType_CalendarViewType;
use EWSType_NonEmptyArrayOfBaseFolderIdsType;
use EWSType_DistinguishedFolderIdType;
use EWSType_DistinguishedFolderIdNameType;

And then the class code:

public function getAgendaItems()
{

    $ews = new ExchangeWebServices(".com", "e.com", "");
    $request = new EWSType_FindItemType();
    // Use this to search only the items in the parent directory in question or use ::SOFT_DELETED
    // to identify "soft deleted" items, i.e. not visible and not in the trash can.
    $request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW;
    // This identifies the set of properties to return in an item or folder response
    $request->ItemShape = new EWSType_ItemResponseShapeType();
    $request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;
    // Define the timeframe to load calendar items
    $request->CalendarView = new EWSType_CalendarViewType();
    $request->CalendarView->StartDate = date("c"); // an ISO8601 date e.g. 2012-06-12T15:18:34+03:00
    $request->CalendarView->EndDate = date("c", mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1)); // an ISO8601 date later than the above
    $request->CalendarView->MaxEntriesReturned = 14;
    // Only look in the "calendars folder"
    $request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
    $request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
    $request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::CALENDAR;
    // Send request
    $response = $ews->FindItem($request);
    // Loop through each item if event(s) were found in the timeframe specified
    if ($response->ResponseMessages->FindItemResponseMessage->RootFolder->TotalItemsInView > 0) {
        $events = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->CalendarItem;
        /*foreach ($events as $event){
            $id = $event->ItemId->Id;
            $change_key = $event->ItemId->ChangeKey;
            $start = $event->Start;
            $end = $event->End;
            $subject = $event->Subject;
            $location = $event->Location;
   //                var_dump($event);
        }*/
        return $events;
    } else {
        return array();
        // No items returned
    }
}

The classes are in src\library\Exchange.

All of the classes are loaded in there but not accessible through this method of mine.

Now my question is: how do I include those classes in my file?

Like the normal include_once thing in php.

It shows this error:

Class 'ExchangeWebServices' not found.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
    • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
    • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
    • ¥15 运动想象脑电信号数据集.vhdr
    • ¥15 三因素重复测量数据R语句编写,不存在交互作用
    • ¥15 微信会员卡等级和折扣规则
    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了