随笔分类 -  php

摘要:if(! function_exists ('timediff') ) { function timediff($begin_time,$end_time){ if($begin_time $days,"hour" => $hours,"min" => $mins,"sec" => $secs); return $res; } 阅读全文
posted @ 2016-12-20 15:49 桔子木木 阅读(2770) 评论(0) 推荐(0)
摘要:if(!function_exists('_GetContent')){ function _GetContent( $url ){ $ch = curl_init(); $ip = '220.181.108.91'; // 百度蜘蛛 $timeout = 15; curl_setopt($ch,CURLOPT_URL,... 阅读全文
posted @ 2016-12-20 15:47 桔子木木 阅读(1690) 评论(0) 推荐(0)
摘要:if(!function_exists('get_date_array')){ function get_date_array(){ $_NOW = time(); $today_begin = strtotime(date('Y-m-d',$_NOW)); $time = strtotime('-2 month', $_NOW); ... 阅读全文
posted @ 2016-12-20 15:46 桔子木木 阅读(551) 评论(0) 推荐(0)
摘要:$num = 10.4567; //第一种:利用round()对浮点数进行四舍五入 echo round($num,2); //10.46 //第二种:利用sprintf格式化字符串 $format_num = sprintf("%.2f",$num); echo $format_num; //10.46 ... 阅读全文
posted @ 2016-12-19 15:14 桔子木木 阅读(245683) 评论(1) 推荐(6)
摘要:在PHP的一些应用中需要写日志或者记录一些信息,这样的话。可以使用fopen(),fwrite()以及 fclose()这些进行操作。也可以简单的使用file_get_contents()和file_put_contents(). file_put_contents()写文件。默认的是重新写文件,也 阅读全文
posted @ 2016-12-12 13:01 桔子木木 阅读(8826) 评论(0) 推荐(0)
摘要:用到的PHP 函数 getImageSize() >获取图片的信息,输出结果为: 阅读全文
posted @ 2016-12-07 11:01 桔子木木 阅读(7945) 评论(0) 推荐(0)