本文整理汇总了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';
}
示例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';
}
示例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();
});
示例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);
}