本文整理汇总了PHP中Sabre\DAV\Server::invokeMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::invokeMethod方法的具体用法?PHP Server::invokeMethod怎么用?PHP Server::invokeMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\DAV\Server
的用法示例。
在下文中一共展示了Server::invokeMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: httpHead
/**
* HTTP HEAD
*
* This method is normally used to take a peak at a url, and only get the
* HTTP response headers, without the body. This is used by clients to
* determine if a remote file was changed, so they can use a local cached
* version, instead of downloading it again
*
* @param RequestInterface $request
* @param ResponseInterface $response
* @return bool
*/
function httpHead(RequestInterface $request, ResponseInterface $response) {
// This is implemented by changing the HEAD request to a GET request,
// and dropping the response body.
$subRequest = clone $request;
$subRequest->setMethod('GET');
try {
$this->server->invokeMethod($subRequest, $response, false);
$response->setBody('');
} catch (Exception\NotImplemented $e) {
// Some clients may do HEAD requests on collections, however, GET
// requests and HEAD requests _may_ not be defined on a collection,
// which would trigger a 501.
// This breaks some clients though, so we're transforming these
// 501s into 200s.
$response->setStatus(200);
$response->setBody('');
$response->setHeader('Content-Type', 'text/plain');
$response->setHeader('X-Sabre-Real-Status', $e->getHTTPCode());
}
// Sending back false will interupt the event chain and tell the server
// we've handled this method.
return false;
}
示例2: testCopyIntoSubPath
/**
* This test makes sure that a path like /foo cannot be copied into a path
* like /foo/bar/
*
* @expectedException \Sabre\DAV\Exception\Conflict
*/
public function testCopyIntoSubPath()
{
$dir = new FS\Directory(SABRE_TEMPDIR);
$server = new Server($dir);
$dir->createDirectory('foo');
$request = new HTTP\Request('COPY', '/foo', ['Destination' => '/foo/bar']);
$response = new HTTP\ResponseMock();
$server->invokeMethod($request, $response);
}