随笔分类 -  PHP

摘要:代码如下所示: 1 2 3 4 5 6 7 8 9 10 11 12 $num = 10.4567; //第一种:利用round()对浮点数进行四舍五入 echo round($num,2); //10.46 //第二种:利用sprintf格式化字符串 $format_num = sprintf(" 阅读全文
posted @ 2020-07-14 14:41 小蚂蚁大梦想 阅读(2790) 评论(0) 推荐(0)
摘要:1.问题: PHP在使用readfile函数定义下载文件时候,文件不可以过大,否则会下载失败,文件损坏且不报错; 2.原因: 这个是因为readfile读取文件的时候会把文件放入缓存,导致内存溢出; 3.解决:分段下载,并限制下载速度; <?php //设置文件最长执行时间 set_time_lim 阅读全文
posted @ 2020-07-10 20:07 小蚂蚁大梦想 阅读(1514) 评论(0) 推荐(0)
摘要:传送门:https://www.w3school.com.cn/php/php_ref_array.asp addcslashes() 返回在指定的字符前添加反斜杠的字符串。 addslashes() 返回在预定义的字符前添加反斜杠的字符串。 bin2hex() 把 ASCII 字符的字符串转换为十 阅读全文
posted @ 2020-07-04 10:16 小蚂蚁大梦想 阅读(136) 评论(0) 推荐(0)
摘要:传送门:https://www.w3school.com.cn/php/php_ref_array.asp array() 创建数组。 array_change_key_case() 把数组中所有键更改为小写或大写。 array_chunk() 把一个数组分割为新的数组块。 array_column 阅读全文
posted @ 2020-07-04 10:08 小蚂蚁大梦想 阅读(346) 评论(0) 推荐(0)