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


PHP Slim::expires方法代码示例

本文整理汇总了PHP中Slim\Slim::expires方法的典型用法代码示例。如果您正苦于以下问题:PHP Slim::expires方法的具体用法?PHP Slim::expires怎么用?PHP Slim::expires使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Slim\Slim的用法示例。


在下文中一共展示了Slim::expires方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: xmlOutput

 /**
  * @param IXmlExporter $exporter
  * @param int $status
  * @param string $contentType
  */
 protected function xmlOutput(IXmlExporter $exporter, $status = 200, $contentType = 'application/xml')
 {
     $this->app->expires(0);
     $this->app->contentType($contentType);
     $response = $this->app->response();
     $response->setStatus($status);
     $response->header('Content-Description', 'File Transfer');
     if ($exporter->isFile()) {
         $response->header('Content-Disposition', 'attachment; filename=' . $exporter->getFileName());
     }
     $response->body($exporter->buildXml());
 }
开发者ID:nextglory,项目名称:CacoCloud,代码行数:17,代码来源:REST.php

示例2: addRouteDefinitions

 /**
  * This methods will be called at application startup
  * @param $appInstance
  * @return void
  * @throws \Exception
  */
 public static function addRouteDefinitions(Slim $appInstance)
 {
     $appInstance->map('/protected-storage/:inst/:id/:accessMethod/:path+', function ($inst, $id, $accessMethod, $path) use($appInstance) {
         if (!in_array($accessMethod, cProtectedStorage::$allowedAccessMethods, true)) {
             $appInstance->halt(400, 'Invalid request');
         }
         $fileName = array_pop($path);
         $rel = '';
         foreach ($path as $value) {
             $rel .= $value . '/';
         }
         $rel .= $fileName;
         $user = null;
         if ($accessMethod === 'private') {
             try {
                 $user = new MembersAuth();
                 $user->isUserLoggedIn();
             } catch (LoginExceptions $e) {
                 $appInstance->halt(401, 'Unauthorized');
             }
         }
         $fullPath = $inst . '/' . $id . '/' . $accessMethod . '/' . $rel;
         $controller = new cProtectedStorage($inst, $id, $accessMethod, $rel);
         if ($controller->isCorrectPath($fullPath)) {
             $appInstance->etag(md5($fullPath));
             $appInstance->expires('+1 week');
             $headers = $controller->outputFile();
             if (array_key_exists('download', $_REQUEST)) {
                 $headers['Content-Type'] = 'application/octet-stream';
             }
             foreach ($headers as $key => $value) {
                 $appInstance->response->headers->set($key, $value);
             }
         } else {
             $appInstance->notFound();
         }
     })->via('GET', 'POST');
 }
开发者ID:indiwine,项目名称:EMA-engine,代码行数:44,代码来源:ProtectedStorageRouting.php

示例3: cacheAndAccessHeader

 public function cacheAndAccessHeader()
 {
     $this->_app->response->headers->set('Access-Control-Allow-Origin', '*');
     $this->_app->expires(date('D, d M Y H:i:s O', time() + $this->_applicationConfig['cacheDuration']));
 }
开发者ID:bigpoint,项目名称:slim-bootstrap,代码行数:5,代码来源:Hook.php


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