A simple API Gateway in Lumen

如何使用 Lumen 开发一个简单的 API Gateway Routes create a file called gateway.php in config folder. Register gateway to lumen routes. Edit AppServiceProvider.php in app/Providers/ folder. Controller AppServiceProvider will send all request …

PHP 冒泡算法

没什么用,写了玩玩的。 function bubble_sort(array $items): array { for ($i = 0; $i < count($items); $i++) { for ($j = $i + 1; $j < count($items); $j++) { if ($items[$i] > $items[$j]) …

Laravel/Lumen Customizing Monolog For Channels

官方文档 https://laravel.com/docs/6.x/logging#creating-monolog-handler-channels 首先 新建一个 文件: 如官方文档所示,可以在 __invoke 方法里定制你的 logger,例如你想要 json 格式的日志的话: 更多设置: 输出的日志样本如下: { “message”: “Undefind method: \”asdasdad\””, “context”: {}, “level”: 400, “level_name”: “ERROR”, “channel”: “local”, “datetime”: “2020-05-11T17:05:07.231673+08:00”, “extra”: { …

Multiple middleware parameters in Lumen

Add route middleware in bootstrap/app.php To middleware to routes within a group, Use “,” separate roles, don’t use “|” as separater, the tutorial from here https://docs.spatie.be/laravel-permission/v3/basic-usage/middleware/ is for Laravel only …

HTTP Public Key Pinning 公钥固定介绍

文件名 内容 chain.pem 浏览器需要的所有证书但不包括服务端证书,比如根证书和中间证书 fullchain.pem 包括了cert.pem和chain.pem的内容 privkey.pem 证书的私钥 cert1.pem或cert.pem 服务端证书 添加以下行并插入适当的 pin-sha256 =“…”的值将在您的nginx上启用HPKP

递归 (JavaScript && PHP)

编程语言中,函数Func(Type a,……)直接或间接调用函数本身,则该函数称为递归函数。递归函数不能定义为内联函数。

Nginx fastcgi_cache And proxy_cache

FastCGI Cache Example FastCGI Cache VS WP Super Cache FastCGI cache is faster than WP Super Cache because the latter uses .htaccess and PHP itself to route the visitor to …