微信获取地理位置 微信 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 location 关键字TYPE =location 就可以 微信 事件分成 文本 位置 时间 图片神马的! 看下各个事件的关键字就好了。!!也可以用CASE 'location' switch($type) { case "event"; if($customevent == "subscribe") {$contentStr = "感谢关注"} break; case "image" $contentStr ="图片很棒"; break; case "location"; $contentStr ="{$latitude},{longitude}"; break; case "text"; switch($keyword) {case "1" $contentStr="1" break; case "2" $contentStr ="2" break; default; $contentStr= "hi";} break; } $msgType = "text"; $resultStr = sprintf($textTpl,$fromUsername,$toUsername,$time,$msgType,$contentStr); echo $resultStr; }else { http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E5%9C%B0%E7%90%86%E4%BD%8D%E7%BD%AE 现在是用微信借口已经得到传过来的信息了private function locationPro(){ //测试 $arrayli = $this->weObj->getRevGeo(); //计算最大最小经纬度 $range = 180 / pi() * 1 / 6372.797; //里面的 1 就代表搜索范围为1km之内 $lngR = $range / cos($arrayli[x] * pi() / 180); $maxLat = $arrayli[y] + $range;//最大纬度 $minLat = $arrayli[y] - $range;//最小纬度 $maxLng = $arrayli[x] + $lngR;//最大经度 $minLng = $arrayli[x] - $lngR;//最小经度 $this->weObj->text("您现在的位置为: ".$arrayli[label]." "."经度为:".$arrayli[x]."纬度".$arrayli[y])->reply(); //测试 $this->selectStores($maxLat,$minLat,$maxLng,$minLng); } 然后根据这个经纬度,在数据库里找经纬度在最大最小范围内的数据,private function selectStores($maxLat,$minLat,$maxLng,$minLng){ //测试 $store_model = M("store"); // 实例化User对象 $condition['latitude'] = array('between','$maxLat','$minLat'); $condition['longitude'] = array('between','$maxLng','$minLng'); $condition['_logic'] = 'AND'; $stores=$store_model->where($condition)->select(); }这些的是不是有问题啊 我刚学php,基本的东西都不太懂,求教。 应该就是这样啦,你这还是Thinkphp框架。刚学PHP的话,已经进步很大啦 $condition['latitude'] = array('between','$min_Y,$max_Y'); $condition['longitude'] = array('between','$min_X,$max_X'); $condition['_logic'] = 'AND'; $stores=$store_model->where($condition)->select();//查询范围之间的店铺但是这个查询出错了,查不出要的数据 php排序1亿个QQ号码 php中面向对象的分页代码的显示问题 修改header里面的Connection为close zend studio 9的运行服务器? 把url中类似16进制的字符串转成汉字 php如何在类中定义常量? COOKIE问题 php 远程post,对方需要用户名密码验证,怎么做 大伙看看这段代码!是什么意思?高手请进! 在线! 各位,进来帮个忙! 微信公众平台PHP代码单图文回复无法实现 php+mysql百万级数据如何排序?
switch($type)
{
case "event";
if($customevent == "subscribe")
{$contentStr = "感谢关注"}
break;
case "image"
$contentStr ="图片很棒";
break;
case "location";
$contentStr ="{$latitude},{longitude}";
break;
case "text";
switch($keyword)
{case "1"
$contentStr="1"
break;
case "2"
$contentStr ="2"
break;
default;
$contentStr= "hi";}
break;
}
$msgType = "text";
$resultStr = sprintf($textTpl,$fromUsername,$toUsername,$time,$msgType,$contentStr);
echo $resultStr;
}else
{
private function locationPro(){ //测试
$arrayli = $this->weObj->getRevGeo();
//计算最大最小经纬度
$range = 180 / pi() * 1 / 6372.797; //里面的 1 就代表搜索范围为1km之内
$lngR = $range / cos($arrayli[x] * pi() / 180);
$maxLat = $arrayli[y] + $range;//最大纬度
$minLat = $arrayli[y] - $range;//最小纬度
$maxLng = $arrayli[x] + $lngR;//最大经度
$minLng = $arrayli[x] - $lngR;//最小经度
$this->weObj->text("您现在的位置为: ".$arrayli[label]." "."经度为:".$arrayli[x]."纬度".$arrayli[y])->reply(); //测试
$this->selectStores($maxLat,$minLat,$maxLng,$minLng);
}
然后根据这个经纬度,在数据库里找经纬度在最大最小范围内的数据,
private function selectStores($maxLat,$minLat,$maxLng,$minLng){ //测试
$store_model = M("store"); // 实例化User对象
$condition['latitude'] = array('between','$maxLat','$minLat');
$condition['longitude'] = array('between','$maxLng','$minLng');
$condition['_logic'] = 'AND';
$stores=$store_model->where($condition)->select();
}
这些的是不是有问题啊 我刚学php,基本的东西都不太懂,求教。
$condition['longitude'] = array('between','$min_X,$max_X');
$condition['_logic'] = 'AND';
$stores=$store_model->where($condition)->select();//查询范围之间的店铺但是这个查询出错了,查不出要的数据