叶测试 发布的文章
PHP根据城市名获取经纬度
/**
- 根据城市名获取经纬度
- @param 城市名 $city
- @return mixed
- http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-geocoding
*/
public function get_geo($city){
$url = "http://api.map.baidu.com/geocoder/v2/?ak=wfVfdMthZRL9vjaeyFKiBhLmUth60bbZ&output=json&address=$city";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
$result = curl_exec($ch);
/* if(curl_errno($ch)){
print_r(curl_error($ch));
} */
curl_close($ch);
return json_decode($result,TRUE);
}
父级页面调用iframe框架子页面中函数
在使用父页面调用子页面iframe框架函数时,一直无法成功,f12查看发现存在域的问题。正是由于未在开发环境中操作导致失败。
JS标准时间格式化处理 格林尼治时间GMT
项目中使用到fullcalender插件,其中插入数据获取的start值为标准时间格式,转化为时间字符串插入。转化方式:
var d = new Date(start);
newStart=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
之后才发现fullcalender的自带formatDate函数来解决:
newStart = $.fullCalendar.formatDate(start, "yyyy-MM-dd");
fullcalender插件使用方式待整理~
使用PHP强制下载PDF文件,解决默认打开问题
我们有时会遇到这样一种情况,当需要下载一个PDF文件时,如果不经处理会直接在浏览器里打开PDF文件,然后再需要通过另存为才能保存下载文件。本文将通过PHP来实现直接下载PDF文件。
php 格式化金钱
<?php
function priceFormat($price) {
$price_format = number_format($price,2,'.',' ');
return $price_format;
}
?>
Thinkphp设置仅在调试模式关闭时显示404页面
常见thinkphp设置404页面为建一个空控制器;里面然后通过_empty()再$this->display跳转到404页面;
thinkphp的配置项里面是有设置错误页面模板的:'TMPL_EXCEPTION_FILE' => APP_DEBUG ? THINK_PATH.'Tpl/think_exception.tpl' : './Template/default/Home/Public/404.html',
css各种手型集合(css禁止手型)
比较齐全的鼠标手型css
.auto { cursor: auto; }
.deafult { cursor: default; }
.none { cursor: none; }
.context-menu { cursor: context-menu; }
.help { cursor: help; }
.pointer { cursor: pointer; }
.progress { cursor: progress; }
.wait { cursor: wait; }
.cell { cursor: cell; }
.crosshair { cursor: crosshair; }
.text { cursor: text; }
.vertical-text { cursor: vertical-text; }
.alias { cursor: alias; }
.copy { cursor: copy; }
.move { cursor: move; }
.no-drop { cursor: no-drop; }
.not-allowed { cursor: not-allowed; }
.all-scroll { cursor: all-scroll; }
.col-resize { cursor: col-resize; }
.row-resize { cursor: row-resize; }
.n-resize { cursor: n-resize; }
.e-resize { cursor: e-resize; }
.s-resize { cursor: s-resize; }
.w-resize { cursor: w-resize; }
.ns-resize { cursor: ns-resize; }
.ew-resize { cursor: ew-resize; }
.ne-resize { cursor: ne-resize; }
.nw-resize { cursor: nw-resize; }
.se-resize { cursor: se-resize; }
.sw-resize { cursor: sw-resize; }
.nesw-resize { cursor: nesw-resize; }
.nwse-resize { cursor: nwse-resize; }