当前位置: 首页>>代码示例>>PHP>>正文


PHP Server::invokeMethod方法代码示例

本文整理汇总了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;

    }
开发者ID:nikosv,项目名称:openeclass,代码行数:39,代码来源:CorePlugin.php

示例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);
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:15,代码来源:CopyTest.php


注:本文中的Sabre\DAV\Server::invokeMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。