//$ak开发密钥,$cityname城市名称(支持省县乡详细地址) public function getposition($ak,$cityname){ $callback=array('lng'=>0,'lat'=>0); $apiUrl='http://api.map.baidu.com/geocoder/v2/?address='.$cityname.'&output=json&ak='.$ak; $ret=json_decode(file_get_contents($apiUrl),true); if($ret['status']==0){ $callback['lng']=$ret['result']['location']['lng']; $callback['lat']=$ret['result']['location']['lat']; } return $callback; }
通常我们使用unset()删除数组的元素,数据的顺序并没有重置,使用array_merge()方法即可解决<?php $shoplist= array('a','b','c','d','e','...
header() 函数向客户端发送原始的 HTTP 报头。(官方解释)通俗的讲header函数将参数中的字符串作为服务端的响应头来返回给客户端。什么是服务端的响应头?打开谷歌浏览器看看network中的请求response header信息即可。更多的参数百度response header即可浏览器...
项目需要使用websocket推送最新订单,客户服务器非linux不支持swoole,因此使用原生,直接上代码(1).PHP服务端<?php ini_set('error_reporting', E_ALL ^ E_NOTICE); ini_set...
先在centos安装openssl,然后开始://生成私钥openssl genrsa -out rsa_private_key.pem 1024//生成公钥openssl rsa -in rsa_private_key.pem&...
<?php /** * @throws Exception */ function curl() { throw new \Exception('err...
php7新增的特性(1).强制限制只能返回一种类型<?php class task { } //must return an integer function add(): int { &nb...