本文整理汇总了PHP中Slim\Slim::flashNow方法的典型用法代码示例。如果您正苦于以下问题:PHP Slim::flashNow方法的具体用法?PHP Slim::flashNow怎么用?PHP Slim::flashNow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slim\Slim
的用法示例。
在下文中一共展示了Slim::flashNow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
$app->flash('addPhotoError', "Error trying to add a photo. Try again?");
$app->log->error(sprintf('Error adding a photo with data: %s: %s', $data, $e->getMessage()));
}
$app->redirect('/admin');
});
$app->post('/admin/delete-photo', function () use($app, $container) {
$day = $app->request()->post('day');
$container['imageService']->delete($day);
$container['cache']->flush();
$app->redirect('/admin');
});
$app->map('/login', function () use($app, $container) {
$email = null;
if ($app->request()->isPost()) {
$email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
$result = $container['userService']->authenticate($email, $_POST['password']);
if ($result->isValid()) {
$app->redirect('/admin');
} else {
$messages = $result->getMessages();
$app->flashNow('error', $messages[0]);
}
}
$app->render('login.html', array('email' => $email));
})->via('GET', 'POST');
$app->get('/logout', function () use($app, $container) {
$container['userService']->clearIdentity();
$app->redirect('/');
});
// Run app
$app->run();
示例2: array
}
$dataArray = array('time' => time(), 'message' => "Run finish");
header("Content-Type: application/json");
echo json_encode($dataArray);
exit;
});
// add new repeater to list
$app->post('/add', function () use($app) {
$app->log->info("Echolink CRON System - '/add' route");
$req = $app->request();
if (masterPassword == $req->post('masterpassword')) {
$echolinksys = new System("mysql:host=" . host . ";dbname=" . database, username, password);
$status = $echolinksys->addRepeater($req->post('callname'), $req->post('email'));
if ($status == true) {
$app->log->info("Echolink CRON System - add new Repeater to DB");
$app->flashNow('info', 'Add repeater!');
} else {
$app->log->info("Echolink CRON System - is exist Repeater to DB");
$app->flashNow('info', 'Fail adding repeater!');
}
}
$url = $app->urlFor('list', array());
$app->redirect($url);
})->name('add');
// delete repeater
$app->post('/delete', function () use($app) {
$app->log->info("Echolink CRON System - '/delete' route");
$req = $app->request();
if (masterPassword == $req->post('masterpassword')) {
$echolinksys = new System("mysql:host=" . host . ";dbname=" . database, username, password);
$status = $echolinksys->removeRepeater($req->post('callname'));
示例3: flashNow
public function flashNow($key, $value)
{
parent::flashNow($key, $value);
return $this;
}