当前位置:网站首页>laravel8更新之维护模式改进
laravel8更新之维护模式改进
2020-11-08 13:07:00 【神兵小将】
原文连接:https://www.wjcms.net/archives/laravel8%E6%9B%B4%E6%96%B0%E4%B9%8B%E7%BB%B4%E6%8A%A4%E6%A8%A1%E5%BC%8F%E6%94%B9%E8%BF%9B
对php artisan down
命令进行了一些非常漂亮的改进。
在以前的版本中,为了只允许某些人访问该网站,您必须使用白名单功能,如本博文所述:
现在支持预渲染维护模式模板,并且消除了最终用户在维护模式期间遇到错误的机会。但是,为此,必须将以下行添加到您的文件中。这些行应直接放在现有常量定义下:public/index.phpLARAVEL_START
define('LARAVEL_START', microtime(true));
if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
require __DIR__.'/../storage/framework/maintenance.php';
}
注:php artisan down --message
已被移除
如何创建自定义Laravel维护页面
使用Laravel 8,您可以拥有一个秘密,而不是使用IP白名单。要配置它,您要做的就是:
php artisan down --secret=YOUR_SECRET_HERE
确保YOUR_SECRET_HERE使用安全的弦线更换零件!
然后访问处于维护模式的网站,请访问 你的域名+/YOUR_SECRET_HERE,这将生成一个秘密cookie,使您可以像往常一样浏览该网站!
这是使您的网站处于维护模式的好方法,但是仍然允许某些人可以访问它!
该php artisan down命令的另一个很棒的补充是您可以预渲染维护页面,这样即使您运行composer update最终用户,仍然可以看到维护页面,而不是一些错误。
为此,只需运行:
php artisan down --render="errors::503"
这样,您可以进行广泛的维护,而不必担心用户看到一些奇怪的错误,而不用担心页面看起来友好。
很酷的是,您可以将标志组合在一起。例如,您可以运行以下命令以在显示的页面上添加机密并同时更改状态代码:
php artisan down --render="errors::503" --status=200 --secret=YOUR_SECRET_HERE
版权声明
本文为[神兵小将]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/3380391/blog/4707666
边栏推荐
- Summary of template engine
- What is the database paradigm
- 啥是数据库范式
- 原创 | 数据资产确权浅议
- Share the experience of passing the PMP examination
- Entry level! Teach you how to develop small programs without asking for help (with internet disk link)
- 应届生年薪35w+ !倒挂老员工,互联网大厂薪资为何越来越高?
- TiDB 性能竞赛 11.02-11.06
- 一文剖析2020年最火十大物联网应用|IoT Analytics 年度重磅报告出炉!
- This year's salary is 35W +! Why is the salary of Internet companies getting higher and higher?
猜你喜欢
啥是数据库范式
On the confirmation of original data assets
The most complete! Alibaba economy cloud original practice! (Internet disk link attached)
Or talk No.19 | Facebook Dr. Tian Yuandong: black box optimization of hidden action set based on Monte Carlo tree search
吐血整理!阿里巴巴 Android 开发手册!(附网盘链接)
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
When kubernetes encounters confidential computing, see how Alibaba protects the data in the container! (Internet disk link attached)
Adobe media encoder /Me 2021软件安装包(附安装教程)
Python基础语法
Why is Schnorr Signature known as the biggest technology update after bitcoin segwit
随机推荐
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
WLAN 直连(对等连接或 P2P)调研及iOS跨平台调研
This time Kwai tiktok is faster than shaking.
Or talk No.19 | Facebook Dr. Tian Yuandong: black box optimization of hidden action set based on Monte Carlo tree search
Flink: from introduction to Zhenxiang (3. Reading data from collection and file)
Xamarin 从零开始部署 iOS 上的 Walterlv.CloudKeyboard 应用
笔试面试题目:判断单链表是否有环
分布式文档存储数据库之MongoDB基础入门
Tidb performance competition 11.02-11.06
Istio流量管理--Ingress Gateway
OR Talk NO.19 | Facebook田渊栋博士:基于蒙特卡洛树搜索的隐动作集黑盒优化 - 知乎
阿里撕下电商标签
Research on WLAN direct connection (peer-to-peer connection or P2P) and cross platform research of IOS
Rust: performance test criteria Library
DeepMind 最新论文解读:首次提出离散概率树中的因果推理算法
Eight ways to optimize if else code
分布式文档存储数据库之MongoDB基础入门
Get PMP certificate at 51CTO College
svg究竟是什么?
Flink from introduction to Zhenxiang (7. Sink data output file)