laravel:维护模式:上线/下线(10.27.0)

一,相关文档:

https://learnku.com/docs/laravel/10.x/configuration/14836#972c4c

二,用artisan工具实现上线下线

1,下线,进入维护模式

[root@img dignews]# /usr/local/soft/php8.2.5/bin/php artisan down

   INFO  Application is now in maintenance mode.

2,上线,关闭维护模式

[root@img dignews]# /usr/local/soft/php8.2.5/bin/php artisan up

   INFO  Application is now live.

3,自定义维护模式的模板:

[root@img news]# cd resources/views/
[root@img views]# mkdir errors
[root@img views]# cd errors/
[root@img errors]# vi 503.blade.php

页面代码:

[root@img errors]# more 503.blade.php
<?php
  $arr = ['code'=>503,'msg'=>'maintain mode'];
  echo json_encode($arr);
?>

说明:刘宏缔的架构森林—专注it技术的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/10/28/laravel-wei-hu-mo-shi-shang-xian-xia-xian-10-27/
代码: https://github.com/liuhongdi/ 或 https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: 371125307@qq.com

三,测试效果

下线后效果:

自定义的维护模式返回:

四,查看laravel框架的版本:

liuhongdi@lhdpc:/data/laravel/dignews$ php artisan --version
Laravel Framework 10.27.0
posted @ 2023-10-29 10:35  刘宏缔的架构森林  阅读(60)  评论(0编辑  收藏  举报