![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
php
redfish_1988
这个作者很懒,什么都没留下…
展开
-
codesignal 练习题
1```boundedRatioYou are given an array of integers a and two integers l and r. You task is to calculate a boolean array b, where b[i] = true if there exists an integer x, such that a[i] = (i + 1) * x and l ≤ x ≤ r. Otherwise, b[i] should be set to fa原创 2021-07-29 03:08:15 · 1594 阅读 · 0 评论 -
laravel sanctum 错误自定义返回
现象sanctum 认证失败会自动返回401或419 errercode,前端认证逻辑这里会受到影响,所以希望可以自定义错误返回。解决方法https://laravel.com/docs/8.x/errors#renderable-exceptions在Exception/Handler 里面定义对应AuthenticationException 的渲染方法 public function register() { $this->reportable(fu原创 2021-09-04 00:20:12 · 720 阅读 · 0 评论 -
PHP常量表的实现
实际项目过程,经常遇到一些键值组成的常量表,今天想了一下怎么用比较好的方式实现这种结构。一个想法是建一个常量表,通过数据库来管理常量,这个实现比较直接,就不展开了。另一个想法是把这种结构用类来表示。abstract class Constants{ static $map = []; public static function getKey($value){ return !empty($key = array_search($value, static::$map)) ? $k原创 2021-08-04 03:00:33 · 183 阅读 · 0 评论