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


PHP BaseController::notFound方法代码示例

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


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

示例1: index

 public function index()
 {
     $quote = $this->QuoteModel->getRandom();
     $quote = $quote[0];
     if (empty($quote)) {
         return parent::notFound();
     }
     $quote['votes'] = $this->VoteModel->getByQuoteId($quote['id']);
     $this->QuoteViewsModel->add($quote['id']);
     include VIEW_ROOT . 'home.php';
 }
开发者ID:ivandaum,项目名称:m2m,代码行数:11,代码来源:HomeController.php

示例2: single

 public function single()
 {
     $id = intval($_GET['id']);
     if (empty($id)) {
         return parent::notFound();
     }
     $quote = $this->QuoteModel->getById($id);
     if (empty($quote)) {
         return parent::notFound();
     }
     $quote = $quote[0];
     $quote['response'] = 2;
     $quote['votes'] = $this->VoteModel->getByQuoteId($id);
     $this->QuoteViewsModel->add($id);
     include VIEW_ROOT . 'quote.php';
 }
开发者ID:ivandaum,项目名称:m2m,代码行数:16,代码来源:QuoteController.php

示例3: function

Route::post('/add-url', 'HomeController@addUrl')->before('csrf');
Route::get('/error/wrong-token', 'BaseController@wrongToken');
// Résultats les plus populaires
Route::get('/most-popular/{page}/{resultsPerPage?}', 'HomeController@mostPopular');
// Résultats des précédentes recherches
Route::get('/history/{page}/{resultsPerPage?}', 'HomeController@history');
// Auto-complétion
Route::post('/autocomplete', function () {
    return LogSearch::startWith(Input::get('q'));
});
// URLs accessibles uniquement en environement de développement
if (Config::get('app.debug')) {
    Route::get('/specs/1', 'DevController@specs');
    Route::get('/lang/csv', function () {
        return Response::download(Utils\Lang\CSV::convert());
    });
}
//// Espace membre
// Connexion
Route::get('/user/login', 'UserController@login');
Route::post('/user/login', 'UserController@tryLogin')->before('csrf');
Route::get('/user/logout', 'UserController@logout');
// Inscription
Route::get('/user/signin', 'UserController@signin');
Route::post('/user/signin', 'UserController@trySignin')->before('csrf');
// Administration des utilisateurs
Route::get('/user/list', 'UserController@listAll');
// Gestion de l'erreur 404
App::missing(function () {
    return BaseController::notFound();
});
开发者ID:kylekatarnls,项目名称:insearch,代码行数:31,代码来源:routes.php

示例4: run

 /**
  * Run app
  *
  * @todo Flash messages
  */
 public function run()
 {
     // Base Controller
     include __DIR__ . "/../controller/BaseController.php";
     $baseController = new BaseController($this->db);
     // Default controller & action
     $ruleController = "Homepage";
     $ruleAction = "default";
     $ruleArgs = array();
     $ruleFound = true;
     // Find by route-rule
     if ($this->requestUri() != '') {
         $ruleFound = false;
         foreach ($this->rules as $rule) {
             if (preg_match_all('/^' . str_replace('/', '\\/', $rule['rule']) . '$/', $this->requestUri(), $matches)) {
                 if (count($rule['args'])) {
                     foreach ($rule['args'] as $argKey => $argVal) {
                         if (substr($argVal, 0, 1) == "\$") {
                             $rule['args'][$argKey] = $matches[(int) substr($argVal, 1)][0];
                         }
                     }
                 }
                 // found rule
                 $ruleController = $rule['controller'];
                 $ruleAction = $rule['action'];
                 $ruleArgs = $rule['args'];
                 $ruleFound = true;
             }
         }
     }
     if (!$ruleFound) {
         $baseController->notFound();
     }
     // Include Controller and run action by rule
     $controllerClass = ucfirst($ruleController) . "Controller";
     $controllerScript = __DIR__ . "/../controller/" . $controllerClass . ".php";
     if (is_file($controllerScript)) {
         include $controllerScript;
     } else {
         $baseController->notFound();
     }
     $thisController = new $controllerClass($this->db);
     call_user_func_array(array($thisController, "action" . ucfirst($ruleAction)), $ruleArgs);
 }
开发者ID:rotten77,项目名称:simpleblog,代码行数:49,代码来源:App.php


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