问题描述
我已使用php artisan down
命令将应用程序放下进行维护.
I have put my application down for maintenance using php artisan down
command.
我的自定义维护页面作为电子邮件输入,用于接受来自用户的电子邮件并将其存储在我的数据库中,以在站点备份并再次运行时通知用户.
My custom maintenance page as a email input to accept the email from the user and store in my database to notify the user when the site is back up and running again.
但是当我使用POST提交表单时,我被重定向到维护模式页面.
But when I submit the form using POST, I get redirected to the maintenance mode page.
我希望一条特定的路线绕过维护模式.有可能吗?
I want one particular route to bypass the maintenance mode. Is it possible?
推荐答案
好的,所以我找到了解决此问题的方法.
Okay so I found a way to go about this problem.
在我的app/routes
文件中,我的路由如下:
In my app/routes
file, I have a route as follows:
// app/routes.php
Route::resource('subscriber', 'SubscriberController');
现在,此路由将匹配形式为subscriber*
Now this will route will match any request URI for the form subscriber*
在我的app/start/global.php
文件中,我在App::down()
// app/start/global.php
App::down(function() {
if(Request::is('subscriber*')) {
return null;
}
return Response::view('maintenance', array(), 503);
})
现在仅对于以subscriber
开头的URI,将不会显示维护模式页面.
Now only for URIs of starting with subscriber
, the maintenance mode page will not be displayed.
:D
这篇关于Laravel 4绕过路由维护模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!