【微信公眾平臺(tái)開發(fā)】百度周邊搜尋接口php封裝
Jun 13, 2016 pm 12:00 PM
【微信公眾平臺(tái)開發(fā)】百度周邊搜索接口php封裝
現(xiàn)在微信公眾平臺(tái)很多娛樂的,都有用到周邊搜索功能,研究下比較簡(jiǎn)單,通過百度周邊搜索接口封裝如下:
調(diào)用格式:
$wechatBaiduAPI = new WechatBaiduAPI();$ret = $wechatBaiduAPI->Place_search($str_key,$location['x'].",".$location['y'] );
參數(shù)說明:
$query:搜素關(guān)鍵詞
$location: 地理位置經(jīng)緯度
$radius: 搜索半徑
<?php class WechatBaiduAPI{ private $api_server_url; private $auth_params; public function __construct() { $this->api_server_url = "http://api.map.baidu.com/place/v2/"; $this->auth_params = array(); $this->auth_params['ak'] = "11ffd27d38deda622f51c9d314d46b1"; } //http://api.map.baidu.com/place/search?&query=眼鏡&location=39.915,116.404&radius=3000&output=json&key=37492c0ee6f924cb5e934fa08c6b1676 public function Place_search($query, $location, $radius=3000) { return $this->call("search", array("output" =>json, "query" => $query,"page_size" =>10, "page_num" => 0, "scope" => 2,"location" => $location, "radius" => $radius)); } protected function call($method, $params = array()) { $params = array_merge($this->auth_params, $params); $url = $this->api_server_url . "$method?".http_build_query($params); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($ch); curl_close($ch); $result = null; $result = json_decode($data,true); return $result; } }
注意:代碼里面的ak,是百度密鑰,每個(gè)百度帳號(hào)都有一個(gè)唯一的ak,具體自己可以百度!
$this->auth_params['ak'] = "11ffd27d38deda622f51c9d314d46b1";

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

First, let me briefly introduce the types of location and matching rules, using the example of nginxwiki as an example: location=/{#matchesthequery/only.[configurationa]}location/{#matchesanyquery,sinceallqueriesbeginwith/,butregular#expressionsandanylongerconventionalblockswillbe#matchedfirst.[ configurationb]}location^~/im

Note: The root and aliasroot instructions in location only set the search root to the directory set by root, that is, the uri will not be truncated. Instead, the original uri will be used to jump to the directory to find the file. The aias instruction will truncate the matching uri, and then Use the path set by alias plus the remaining uri as a sub-path to find the uri of proxy_pass in location. If the url of proxy_pass does not have uri, if the tail is "/", the matching uri will be truncated. If the tail is not "/", then Will not truncate the matching uri if the proxy_pass url contains uri

Part 1: Initial Troubleshooting Steps Checking Apple’s System Status: Before delving into complex solutions, let’s start with the basics. The problem may not lie with your device; Apple's servers may be down. Visit Apple's System Status page to see if the AppStore is working properly. If there's a problem, all you can do is wait for Apple to fix it. Check your internet connection: Make sure you have a stable internet connection as the "Unable to connect to AppStore" issue can sometimes be attributed to a poor connection. Try switching between Wi-Fi and mobile data or resetting network settings (General > Reset > Reset Network Settings > Settings). Update your iOS version:

php提交表單通過后,彈出的對(duì)話框怎樣在當(dāng)前頁(yè)彈出php提交表單通過后,彈出的對(duì)話框怎樣在當(dāng)前頁(yè)彈出而不是在空白頁(yè)彈出?想實(shí)現(xiàn)這樣的效果:而不是空白頁(yè)彈出:------解決方案--------------------如果你的驗(yàn)證用PHP在后端,那么就用Ajax;僅供參考:HTML code

Watch4pro and gt each have different features and applicable scenarios. If you focus on comprehensive functions, high performance and stylish appearance, and are willing to bear a higher price, then Watch 4 Pro may be more suitable. If you don’t have high functional requirements and pay more attention to battery life and reasonable price, then the GT series may be more suitable. The final choice should be decided based on personal needs, budget and preferences. It is recommended to carefully consider your own needs before purchasing and refer to the reviews and comparisons of various products to make a more informed choice.

Server matching logic When nginx determines which server block to execute a request, it mainly focuses on the listen and server_name fields in the server block. The listen command listen field defines the IP and port of the server response. If the listen field is not explicitly configured, the default listening 0.0.0.0:80 (root) or 0.0.0.0:8080 (non-root) listen can be configured as: a combination of ip and port, a single ip, listening on port 80 by default, a single port, and listening on all ip interfaces by default A unixsocket path where the last entry is usually only used in different
