php-ews
을 기존 OOP 이외 웹 사이트에서 구현합니다.php-ews : 클래스에 대한 전체 경로를 사용할 때 'SoapClient'클래스를 찾을 수 없습니다.
쉘에서 독립 실행 형 PHP 스크립트를 실행해도 문제가 없습니다. (즉 new \jamesiarmes\PhpEws\Client
)
use \jamesiarmes\PhpEws\Client;
use \jamesiarmes\PhpEws\Request\CreateItemType;
그러나 나는 웹 사이트에 내 경우-문을 use
을 사용할 수 없습니다, 그래서 전체 경로를 사용하여 모든 클래스 앞에 추가 :
독립 PHP 스크립트는 use
사용합니다.
이제이 오류가 발생합니다.
Fatal error: Class 'SoapClient' not found in /home/project/master/vendor/jamesiarmes/php-ntlm/src/SoapClient.php on line 13
if ($_REQUEST['action'] == 'export-form-test') {
require_once 'vendor/autoload.php';
/*
use \jamesiarmes\PhpEws\Client;
use \jamesiarmes\PhpEws\Request\CreateItemType;
use \jamesiarmes\PhpEws\ArrayType\NonEmptyArrayOfAllItemsType;
use \jamesiarmes\PhpEws\ArrayType\NonEmptyArrayOfAttendeesType;
use \jamesiarmes\PhpEws\Enumeration\BodyTypeType;
use \jamesiarmes\PhpEws\Enumeration\CalendarItemCreateOrDeleteOperationType;
use \jamesiarmes\PhpEws\Enumeration\ResponseClassType;
use \jamesiarmes\PhpEws\Enumeration\RoutingType;
use \jamesiarmes\PhpEws\Type\AttendeeType;
use \jamesiarmes\PhpEws\Type\BodyType;
use \jamesiarmes\PhpEws\Type\CalendarItemType;
use \jamesiarmes\PhpEws\Type\EmailAddressType;
*/
// Replace this with your desired start/end times and guests.
$start = new DateTime('tomorrow 4:00pm');
$end = new DateTime('tomorrow 5:00pm');
// Set connection information.
$host = '*********';
$username = '*******';
$password = '********';
//$version = Client::VERSION_2016;
$client = new \jamesiarmes\PhpEws\Client($host, $username, $password);
// Build the request,
$request = new \jamesiarmes\PhpEws\Request\CreateItemType();
$request->SendMeetingInvitations = \jamesiarmes\PhpEws\Enumeration\CalendarItemCreateOrDeleteOperationType::SEND_ONLY_TO_ALL;
$request->Items = new \jamesiarmes\PhpEws\ArrayType\NonEmptyArrayOfAllItemsType();
// Build the event to be added.
$event = new \jamesiarmes\PhpEws\Type\CalendarItemType();
$event->Start = $start->format('c');
$event->End = $end->format('c');
$event->title = 'EWS Test Event';
// Set the event body.
$event->Body = new \jamesiarmes\PhpEws\Type\BodyType();
$event->Body->_ = 'This is the event body';
$event->Body->BodyType = \jamesiarmes\PhpEws\Enumeration\BodyTypeType::TEXT;
// Add the event to the request. You could add multiple events to create more
// than one in a single request.
$request->Items->CalendarItem[] = $event;
$response = $client->CreateItem($request);
// Iterate over the results, printing any error messages or event ids.
$response_messages = $response->ResponseMessages->CreateItemResponseMessage;
foreach($response_messages as $response_message) {
// Make sure the request succeeded.
if ($response_message->ResponseClass != ResponseClassType::SUCCESS) {
$return_arr['status'] = 'error';
continue;
}
// Iterate over the created events, printing the id for each.
foreach($response_message->Items->CalendarItem as $item) {
$id = $item->ItemId->Id;
$return_arr['status'] = 'ok';
}
}
}
서버와 컴퓨터의 PHP 버전은 무엇입니까? 'vendor/autoload.php'파일의 위치는 어디입니까? 소스 코드를 포함 시키거나 링크시킬 수 있습니까? –