![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
随手来一段代码
dudenglan
飞花摘叶皆可伤人,草木竹石均可为剑
展开
-
PHPExcel---导出 Allowed memory size of
项目要求:为了导出一个比较炫好看的EXCEL,采用的模板填补数据方式。 异常错误:测试了一把,报内存溢出了; 问题定位:excel.xls模板问题;(将A列全部合并导致) 方法一:不停的增加 memory_limit 于事无补; 方法二:把excel模板修改为普通空模板、导出正常 解决方案: 模板不要涉及不必要的行列数据、在数据填充时,会将模板操作的数据进行加载,导致内存溢出 ...原创 2022-02-08 09:58:27 · 418 阅读 · 0 评论 -
PHP-限流-TokenBucket
public function checkLimit($cacheKey = '', $initNum = '', $expire = '', $retry = true) { $nowTime = time(); Redis::watch($cacheKey); $redisData = Redis::get($cacheKey); $limitData = $redisData ? json_decode($redisData, true) : ['num' =>.原创 2022-02-08 09:43:56 · 1216 阅读 · 0 评论 -
PHP 搞一个 ewm 平滑算法函数
<?php functionewm($arr, &$result,$alpha=1) { $len=count($arr); $numerator=$arr[$len-1];//分子 $denominator=1;//分母 for($i=1;$i<64&&$i<$len;$i++) { $numerator+=$arr[$len- ($i+1)] *pow(1-$alpha,$i); $denomina...原创 2020-12-24 14:11:29 · 493 阅读 · 0 评论 -
PHP 生成xmind文件
xmind的内部结构由 三部分组成 style.xml comments.xml content.xml $fileList = []; //style.xml文件 $styleFile = './general/styles.xml'; $style = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?> <xmap-styles xmlns:svg="http://www.w3.org/2000/svg" xml.原创 2020-12-22 14:12:37 · 620 阅读 · 1 评论