php
benzun_yinzi
这个作者很懒,什么都没留下…
展开
-
phpexcel中PHPExcel_Exception Invalid cell coordinate [1解决办法
1、当导出的首行字段超过26的字符的时候,就会报出错误,错误信息如下: PHPExcel_Exception Invalid cell coordinate [1 原因: 这个不是条数多了出问题,而是列超过26列出的问题。 仔细看看excel表格,z后面是AA、AB、AC,因此输出的时候需要判断。 解决办法:public function actionExcel(){ /**原创 2017-08-17 16:14:37 · 9752 阅读 · 0 评论 -
datatable结合php使用(yii2)
1、官网地址:http://datatables.club/example/server_side/simple.htmlhttp://datatables.club/example/diy.html2、基本常用设置:前端设置:$this->registerJs("$(function() { var times = false;//防止多次回调显示重复 $('#exa原创 2017-08-17 16:16:46 · 3292 阅读 · 1 评论 -
yii框架中使用phpexcel得到的excel文件作为附件发送
1、使用mail:Yii::$app->mailer->compose() ->setTo($this->send_to) ->setSubject($this->subject) ->attachContent($this->attach_file, ['fileName' => $this->attach_file_nam原创 2017-09-21 18:06:36 · 629 阅读 · 0 评论 -
关于yii2框架中内存泄漏的解决方案
现象描述: 命令行执行一个7万行的脚本,循环里进行各种查询。结果每次都会报出内存溢出的错误,类似于这样: 第 475 次,消耗内存 312.68MB第 476 次,消耗内存 313.22MB第 477 次,消耗内存 313.79MB。还是报错。内存溢出。Allowed memory size of 402653184 bytes exhausted (tried to allocate 8388原创 2017-09-07 20:53:44 · 3168 阅读 · 5 评论 -
php中获得中国式的周的日期方式
php中有的时候想获取某周的开始和结束日期,不是很方便,于是自己收拾了一套。 /** * 日期转换成中国式的周一和周日,num=-1默认返回本周周一和周日的日期 * 0表示上周 1表示上上周 * -2表示下周 -3表示下下周 * 以此类推 */ public static function dealDate($num = -1)原创 2017-08-15 15:05:08 · 198 阅读 · 0 评论 -
多数组合并,键值既有字母又有数字时,如何统一为字母键值?
多数组合并中,键值既有字符又有数字合并时,如何统一为字符键值?$arr1 = [ 'appstore' => 'appstore', 'xiaoqi' => 'xiaoqi', 'xiaoba' => 'xiaoba',];$arr2 = [ 4399 => '4399',];如果这两数组要进行合并,希望得到的结果是$原创 2017-08-07 15:00:53 · 665 阅读 · 1 评论 -
好玩的线上检测代码工具-codewars(5)
Compare two strings by comparing the sum of their values (ASCII character code). For comparing treat all letters as UpperCase.Null-Strings should be treated as if they are empty strings. If the strin原创 2017-08-14 17:59:50 · 656 阅读 · 0 评论 -
好玩的线上检测代码工具-codewars(1)
检测环境: http://www.codewars.com 基本描述:Task:Your task is to write a function which returns the sum of following series upto nth term(parameter).Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +…Rules:You need原创 2017-08-14 15:54:41 · 694 阅读 · 0 评论 -
好玩的线上检测代码工具-codewars(4)
You are going to be given a word. Your job is to return the middle character of the word. If the word’s length is odd, return the middle character. If the word’s length is even, return the middle 2 cha原创 2017-08-14 16:52:14 · 418 阅读 · 0 评论 -
好玩的线上检测代码工具-codewars(3)
Complete the solution so that it splits the string into pairs of two characters. If the string contains an odd number of characters then it should replace the missing second character of the final pair原创 2017-08-14 16:38:31 · 438 阅读 · 0 评论 -
好玩的线上检测代码工具-codewars(2)
【好玩的coderwars-第二个练习】 You are given an array strarr of strings and an integer k. Your task is to return the first longest string consisting of k consecutive strings taken in the array.Example: longest_原创 2017-08-14 16:26:17 · 554 阅读 · 0 评论 -
PHP中使用strtotime的坑
虽然说这个问题在工作前两年的时候经常碰到,也都是这么解决的。当时没有记录博客的习惯。今天早上看到鸟哥更新了一篇关于strtotime的博客。那我就直接引用过来好啦。鸟哥博客链接如下:http://www.laruence.com/2018/07/31/3207.html看完这个,我确定我之前使用的确实没问题。一下子不慌了。以前只要是涉及这个函数的地方,我都万分小心。 ...原创 2018-08-06 10:39:26 · 3880 阅读 · 0 评论