![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PHP
温暖如春520
这个作者很懒,什么都没留下…
展开
-
PHP按自然月计算未来日期
背景:有时候需求需要计算从今天开始的5个月之后应该是哪一天。而跨年、每个月有大小月,或者月份中可能有28/29天,而PHP的strtotime的+n month有可能就不准确了(如:2月28日加三个月,需求可能想到5月31日,而strtotime出来则是5月28日)。为解决这个问题,方法如下。原创 2024-04-19 09:21:11 · 446 阅读 · 1 评论 -
PHP一些算法
PHP排序原创 2022-09-21 14:31:51 · 123 阅读 · 0 评论 -
PHP策略模式实现demo
策略模式是为了降低耦合,对相同的属性或方法进行封装,不同的地方通过调用实现各自的功能。策略模式是行为型模式,它定义了一系列的算法,并将每一个算法封装起来,而且使它们还可以相互替换。策略模式让算法独立于使用它的客户而独立变化。自己写了个demo,备忘一下<?phpinterface Human{ public function shuxing();}class man im...原创 2019-05-07 10:33:40 · 183 阅读 · 0 评论 -
PHP单例模式demo
单例模式是为了解决同一资源重复调用,对常用的一些方法进行静态化处理,节约资源<?phpclass Single{ private static $instance; private function __construct($host = '',$user = '',$pass = '',$db = ''){ mysqli_conne...原创 2019-05-07 11:40:44 · 471 阅读 · 0 评论 -
php面向对象中self和static的区别
在php的面向对象编程中,总会遇到class test{ public static function test(){ self::func(); static::func(); } public static function func(){}}可你知道self和static的区别么?其实区别很简单,只需要写几个demo就能懂:Demo for...转载 2019-05-22 10:38:22 · 216 阅读 · 0 评论 -
upstream timed out (10060: A connection attempt failed because the connected party did n
[error] 7360#2940: *23 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because conn...原创 2019-05-31 14:57:09 · 7122 阅读 · 2 评论