linux nginx
Renew 全栈工程师
全栈开发工程师
展开
-
phpize 错误 Cannot find autoconf Please check your autoconf installatio
出现这个错误是因为没有安装 autoconf,安装一下即可ubuntusudo apt install autoconfcentosyum install autoconfphpizeConfiguring for:PHP Api Version: 20180731Zend Module Api No: 20180731Zend Extension Api No: 320180731...原创 2020-09-16 14:21:19 · 156 阅读 · 0 评论 -
php获取重复文件,删除重复文件
#上代码<?php$files = [];/** * @param $path * @param bool $isDir * @return Generator|void */function readDirFiles($path, $isDir = false){ $path = rtrim($path, '/*'); if (!is_readable($path)) return; $dh = opendir($path); while原创 2020-09-16 14:20:34 · 266 阅读 · 0 评论 -
php获取文件mime方法
#注意fileinfo是php7扩展,必须要安装fileinfo,可以查看这篇文章进行安装一、获取文件mime代码$finfo = finfo_open(FILEINFO_MIME);$mimetype = finfo_file($finfo, $filename);finfo_close($finfo);echo $mimetype;二、获取文件数据mime代码$finfo = finfo_open(FILEINFO_MIME);$mimetype = finfo_buff原创 2020-09-16 14:19:52 · 385 阅读 · 0 评论 -
php 自动把秒转换成分,时,天,周,月,年...
<?phpclass Calendar{ /** * 一分钟的秒数 */ const TIME_MINUTE = 60; /** * 一小时的秒数 */ const TIME_HOURS = 3600; /** * 一天的秒数 */ const TIME_DAY = 3600 * 24; /** * 一周的秒数 */ const TIME_WE原创 2020-09-16 14:15:34 · 705 阅读 · 0 评论 -
php 数组跟对象效率对比
#1.上测试效果截图#2.测试代码(可以自行运行测)<?phpini_set('memory_limit', '5G');/** * 整数转小数 * @param $num * @param $length * @return false|string */function roundNum($num, $length){ if ($len = strpos($num, '.')) { $dianNum = substr($num, $len +原创 2020-09-16 14:11:11 · 570 阅读 · 0 评论 -
php 内存引用,释放问题
在一般的场景中,php作为一个脚本,执行完毕就会释放调所有的内存,所以一般我们也不会太考虑内存问题,对象 数组随便复制引用但是现在如果我们换到了swoole 或者其他的进程式的程序栈中,我们如何保证内存不会越来越高,或者如果我们要自己写一套高效率的框架,那我们的内存到底如何分配才合理带着这些疑问,我就就行了一下测试,得出了一下结论,供大家参考#1.对象何时销毁<?phpclass AObject{ public function print() { ech原创 2020-09-16 14:10:41 · 628 阅读 · 0 评论 -
php 阶加,阶乘算法
#1.阶加1.何为阶加1+2+3+4+5+6+…+n2.应用场景计算一组数生成可用数的不重复次数,比如用 123 3个数生成不重复组合123132213231312321可以生成6次不同的组合那么次数=1+2+3 = (1 + 3) * 3 / 2代码function termial($n){ return (1 + $n) * $n / 2;}#2.阶乘1.何为阶乘1*2*3*4*5*6*…*n数学公式:n!代码function fact原创 2020-09-16 14:10:10 · 2330 阅读 · 0 评论 -
php-计算两个时间差
官方代码$january = new DateTime('2010-01-01');$february = new DateTime('2010-02-01');$interval = $february->diff($january);// %a will output the total number of days.echo $interval->format('%a total days')."\n";// While %d will only output the nu原创 2020-09-16 14:09:40 · 135 阅读 · 0 评论 -
linux下编译安装nginx
1.首先下载稳定版nginx1.10.2 使用wget命令下载wget http://nginx.org/download/nginx-1.10.2.tar.gz2.然后解压tar -zxvf nginx-1.10.2.tar.gz3.安装依赖库sudo apt-get install libpcre3-dev aptitude li原创 2016-11-25 23:09:11 · 363 阅读 · 0 评论