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


PHP Slim::pass方法代码示例

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


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

示例1: get

 public function get($cssFile)
 {
     $scssPath = PROJECT_ROOT . '/src/scss';
     $scssFile = $scssPath . '/' . str_replace('css', 'scss', $cssFile);
     /** Pass the route if file don't exists, will result in 404 */
     if (!file_exists($scssFile)) {
         return $this->slim->pass();
     }
     $this->slim->response->headers->set('Content-Type', 'text/css');
     $this->compiler->addImportPath($scssPath);
     echo $this->compiler->compile(file_get_contents($scssFile));
 }
开发者ID:etu,项目名称:0bRSS,代码行数:12,代码来源:Scss.php

示例2: addRouteDefinitions

 /**
  * Adds a backend routes
  * @param $appInstance
  * @return void
  */
 public static function addRouteDefinitions(Slim $appInstance)
 {
     $appInstance->group('/admin', function () use($appInstance) {
         $appInstance->get('/', function () {
             print '<h1>A Simple Backend</h1>';
         });
         $appInstance->map("/chpass", function () use($appInstance) {
             if (EMA_ADMIN_CHPASS) {
                 AdminPasswordChange_controller::process();
             } else {
                 $appInstance->pass();
             }
         })->via('GET', 'POST');
         $appInstance->map("/update", function () use($appInstance) {
             ClassAndMethodsDispatcher::updateGPMethods();
         })->via('GET', 'POST');
         $appInstance->post("/login", function () use($appInstance) {
             $appInstance->response->headers->set('Cache-Control', 'no-store');
             if (isset($_POST['username']) && is_string($_POST['username']) && (isset($_POST['password']) && is_string($_POST['password']))) {
                 try {
                     try {
                         $user = new UserAuth();
                     } catch (SessionExpired $e) {
                         $user = new UserAuth();
                     }
                     $user->userLogin($_POST['username'], $_POST['password']);
                     if (!$user->isAdmin()) {
                         $user->logout();
                         throw new LoginIncorrect('You are not allowed to login here');
                     }
                     $appInstance->response->headers->set('Content-Type', 'application/json');
                     print json_encode($user->getSessionAuthData());
                 } catch (LoginIncorrect $e) {
                     $appInstance->response->headers->set('Content-Type', 'text/plain');
                     $appInstance->response->setStatus(400);
                     print $e->getMessage();
                 }
             } else {
                 $appInstance->response->headers->set('Content-Type', 'text/plain');
                 $appInstance->response->setStatus(400);
                 print 'Bad request';
             }
         });
         $appInstance->map('/logout', function () use($appInstance) {
             try {
                 $user = new UserAuth();
                 if ($user->isUserLoggedInSimple()) {
                     $user->logout();
                 }
             } catch (SessionExpired $e) {
             }
         })->via('GET', 'POST');
     });
 }
开发者ID:indiwine,项目名称:EMA-engine,代码行数:59,代码来源:BackendRouting.php

示例3: callbackCheckDataset

 /**
  * Middleware callback used to check for valid store.
  * It is not intended that you call this function yourself.
  * @throws \InvalidArgumentException Exception thrown if callback invoked incorrectly.
  */
 public function callbackCheckDataset()
 {
     // get the store name
     $args = func_get_args();
     if (count($args) === 0 || !$args[0] instanceof \Slim\Route) {
         throw new \InvalidArgumentException('This method should not be invoked outside of the Slim Framework');
     }
     $this->store = $args[0]->getParam('store');
     // if the store is not valid, skip the current route
     if (!isset($this->stores[$this->store])) {
         $this->app->pass();
     }
     // display name of store in titlebar
     $u = $this->app->request()->getRootUri() . '/datasets/' . $this->store;
     $this->app->view()->set('titleSupplementary', '<a href="' . htmlspecialchars($u, ENT_QUOTES) . '" class="navbar-brand supplementary">' . htmlspecialchars($this->storeOptions[$this->store]['shortName']) . '</a>');
 }
开发者ID:joetm,项目名称:sameAs-Lite,代码行数:21,代码来源:WebApp.php

示例4: send404NotFound

function send404NotFound(Slim $app)
{
    $app->pass();
}
开发者ID:ashleighpearson,项目名称:developer-documentation,代码行数:4,代码来源:page.php


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