伪造IP 和UA 请求

作者:sanlanlan 时间:2018-8-9 标签: PHP 分类: php IP.UA浏览数:4415

$binfo =array('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2; AskTbPTV/5.17.0.25589; Alexa... 阅读全文

json 数据在HTML 中输出

作者:sanlanlan 时间:2018-1-23 标签: PHP 分类: php json json_encode json_decode浏览数:1330

因为数据库设计的需要,数据库会存 json 的数据。 如:{type:1,info:uid not used,data:{time:15,name:hahaha}} 直接在json_encode()函数中增加... 阅读全文

PHP 四舍五入精确小数位及取整

作者:sanlanlan 时间:2017-12-11 标签: PHP 分类: php 函数 ceil round floor浏览数:933

PHP经常用到取整的函数,下面收集了四个函数; 阅读全文

给定一段时间,判断是否包含周末,并计算周末天数

作者:sanlanlan 时间:2017-11-25 标签: PHP 分类: php 周末 时间段浏览数:1000

有时我们在工作中国需要某个时间段进行某项任务,或者需要对周末这个特殊时间做特殊处理。 使用PHP可以实现,判断这个时间段,是否包含周末,及计算周末的时间 1.//判断是否包含周末 function isWeekend($start_t... 阅读全文

随笔笔记

作者:sanlanlan 时间:2017-11-9 标签: PHP 分类:浏览数:742

1.利用Jquery 比较两个时间的大小: body form action= input type=text name=begin_time id=begin begin input ty... 阅读全文

通过IP来判断坐标地点

作者:sanlanlan 时间:2017-8-2 标签: PHP 分类: 坐标 IP浏览数:939

这是一个非常实用的代码片段帮助你通过IP来判断地点。下面的方法接受一个参数,然后返回IP所在地点。如果没有找到,则返回UNKNOWN。 function detect_city($ip) { $d... 阅读全文

手机号的归属地查询

作者:sanlanlan 时间:2017-7-9 标签: PHP 分类: php 归属地浏览数:939

要使用PHP判断手机号的归属地,方法有很多,有一种是利用第三方提供的api,例如 淘宝网API API地址: http://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=15850781443  ... 阅读全文

strtotime('-x month')的bug

作者:sanlanlan 时间:2017-5-6 标签: PHP 分类: php strtotime浏览数:1319

对于strtotime('-x month'); 在涉及到月份修改的时候,可能不会得到预料的结果。 如:当前时间为: 2015-08-31 ?php $t = time(); print_r(array(... 阅读全文

1 2