Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of realizing location Map display by php

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "php to achieve positioning map display method", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "php positioning map display method"!

This article operating environment: windows7 system, PHP7.1 version, Dell G3 computer.

How to realize the location map display by php?

Php: Web development to achieve Wechat JS (positioning, map display, photo selection function)

Today, let's talk about the functions of JS in Wechat web page development and share it. I hope it will be helpful to you.

Premise: to have an official account, and through Wechat authentication, bind the domain name, get the corresponding information, appid,appsecret and so on.

Wechat development document: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115

Take a look at the effect picture:

1: introduce JS file 2:config API injection permission verification configuration wx.config ({debug: false, appId: appid, timestamp: timestamp, nonceStr: noncestr, signature: signature, jsApiList: ['openLocation',' chooseImage']})

Note: all pages that need to use JS-SDK must first inject configuration information, otherwise it will not be called (the same url only needs to be called once, and the web app of the SPA that changes the url can be called each time the url changes.

Currently, the Android Wechat client does not support the new H5 feature of pushState, so pages that use pushState to implement web app will cause the signature to fail, which will be fixed in Android6.2.

The JS that clicks the button in html:

/ / locate $("# location") .click (function () {wx.getLocation ({type: 'wgs84', / / defaults to the gps coordinates of wgs84). If you want to return the Martian coordinates directly to openLocation, pass' gcj02' success: function (res) {var latitude = res.latitude / / Latitude, floating point number, range is 90 ~-90 var longitude = res.longitude; / / longitude, floating point number, range is 180 ~-180. Var speed = res.speed; / / speed, var accuracy = res.accuracy; / / position accuracy DSXUI.success in meters per second ('latitude' + latitude); $("# qrcodevalue"). Text ('latitude' + latitude+ "- longitude" + longitude);});}) / / Map $("# btn1") .click (function () {wx.openLocation ({latitude: 26.581379, / / latitude, floating-point number, range: 90-90 longitude: 104.86983, / / longitude, floating-point number, range: 180-- 180. Name: 'Guiyang City, Guizhou Province', / / location name address: 'details address', / / address details description scale: 22, / / Map Zoom level, shaping value, range from 1x28. Defaults to the maximum infoUrl: 'http://h6.zhangwoo.cn/?m=weixin&c=wxtest&a=share' / / the hyperlink displayed at the bottom of the View location interface, which can be clicked to jump, useless});}) / / Wechat choose figure $("# btn2") .click (function () {wx.chooseImage ({count: 3, / / default 9 sizeType: ['original',' compressed'], / / you can specify whether it is the original image or a compressed image) By default, both have sourceType: ['album',' camera'], / / you can specify whether the source is a photo album or a camera, and by default both have success: function (res) {var localIds = res.localIds / / returns the local ID list of selected photos. LocalId can display the image $("# qrcodevalue") .text ('local ID list of photos' + localIds) as the src attribute of the img tag;}});})

Note: the parameter appid,appsecret and other information I used are in the php code.

Thank you for your reading, the above is the content of "the method of php to achieve positioning map display". After the study of this article, I believe you have a deeper understanding of the method of positioning map display by php, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report