Laravel 5.2のすべての私のルートに対してステータスコード503を起動します。laravel routes.phpファイルを持つすべてのルートに対して503のステータスを起動します
私は 'php artisan down'コマンドを使用できません。
だから私はファイルroutes.phpで手動でやりたいと思っています。
私はこれをしようとしますが、動作していない:
Route::any('/',function(){#this code not work for me
dd('not arrive here');
return abort(503);
});
は完全route.phpファイルです:私は私のサイトのすべてのルート上に503の状態を起動するにはどうすればよい
<?php
Route::any('/',function(){#this code not work for me
dd('not arrive here');
return abort(503);
});
// extra langs
$conf = Config::get('app.current_site_config');
$langs = [];
$langs[] = $conf['lng_default'];
if (!empty($conf['lng_extra']))
$langs = array_merge($conf['lng_extra'],$langs);
$prefix = false;
if (count($langs) > 1)
$prefix = true;
$pages = Config::get('app.web_config.lang_url');
foreach($langs as $lang)
{
foreach($pages as $key=>$value)
{
$key_underscored = str_replace('-','_',$key);
if ($prefix == false)
{
//echo $key_underscored.'_'.$lang.'<br>';
Route::any('/'.$value[$lang],['as' => $key_underscored.'_'.$lang, 'uses' => '[email protected]'.$key_underscored ]);
Route::get('/'.$value[$lang].'/{seo_name}/{id}',['as' =>$key_underscored.'_seo_'.$lang, 'uses' => '[email protected]'.$key_underscored]);
Route::get('/404-error', ['as' => 'error404'.'_'.$lang, 'uses' => '[email protected]']);
Route::get('/500-error', ['as' => 'error500'.'_'.$lang, 'uses' => '[email protected]']);
Route::post('shipping-info-post', ['as' => 'shipping_info_post'.'_'.$lang, 'uses' => '[email protected]_info_post']);
Route::post('payment-post', ['as' => 'payment_post'.'_'.$lang, 'uses' => '[email protected]_post']);
Route::post('cart-post', ['as' => 'cart_post'.'_'.$lang, 'uses' => '[email protected]_post']);
}
else
{
//echo '/'.$lang.'/'.$value[$lang] . ' as '.$key_underscored.'_'.$lang.' uses '. '[email protected]'.$key_underscored.'<br>';
Route::any('/'.$lang.'/'.$value[$lang],['as' => $key_underscored.'_'.$lang, 'uses' => '[email protected]'.$key_underscored]);
Route::get('/'.$lang.'/'.$value[$lang].'/{seo_name}/{id}',['as' =>$key_underscored.'_seo_'.$lang, 'uses' => '[email protected]'.$key_underscored]);
// generic (not optimized for SEO)
Route::get('/'.$lang.'/404-error', ['as' => 'error404_'.$lang, 'uses' => '[email protected]']);
Route::get('/'.$lang.'/500-error', ['as' => 'error500_'.$lang, 'uses' => '[email protected]']);
Route::post('/'.$lang.'/shipping-info-post', ['as' => 'shipping_info_post_'.$lang, 'uses' => '[email protected]_info_post']);
Route::post('/'.$lang.'/payment-post', ['as' => 'payment_post_'.$lang, 'uses' => '[email protected]_post']);
Route::post('/'.$lang.'/cart-post', ['as' => 'cart_post_'.$lang, 'uses' => '[email protected]_post']);
}
}
}
if (count($langs) > 1)
{
Route::get('/',function(){
header('Location: '.route('index_'.Config::get('app.locale')).'/');
exit;
});
}
else
Route::get('/', ['as' => 'index_'.$langs[0], 'uses' => '[email protected]']);
?
でいますか? –
Laravel docs:ミドルウェア、これを達成しようとするときにoyuに問題があるかどうか尋ねる – Vuldo