标签 笔记 下的文章
正则表达式中需要转义的特殊字符
$ 匹配输入字符串的结尾位置。如果设置了 RegExp 对象的 Multiline 属性,则 $ 也匹配 ‘\n' 或 ‘\r'。要匹配 $ 字符本身,请使用 \$
( ) 标记一个子表达式的开始和结束位置。子表达式可以获取供以后使用。要匹配这些字符,请使用 和
* 匹配前面的子表达式零次或多次。要匹配 * 字符,请使用 \*
+ 匹配前面的子表达式一次或多次。要匹配 + 字符,请使用 \+
. 匹配除换行符 \n之外的任何单字符。要匹配 .,请使用 \
[ ] 标记一个中括号表达式的开始。要匹配 [,请使用 \[
? 匹配前面的子表达式零次或一次,或指明一个非贪婪限定符。要匹配 ? 字符,请使用 \?
\ 将下一个字符标记为或特殊字符、或原义字符、或向后引用、或八进制转义符。例如, ‘n' 匹配字符 ‘n'。'\n' 匹配换行符。序列 ‘\\' 匹配 “\”,而 ‘\(' 则匹配 “(”
^ 匹配输入字符串的开始位置,除非在方括号表达式中使用,此时它表示不接受该字符集合。要匹配 ^ 字符本身,请使用 \^
{ } 标记限定符表达式的开始。要匹配 {,请使用 \{
| 指明两项之间的一个选择。要匹配 |,请使用 \|
win10 wampserver httpd.exe - 应用程序错误 应用程序无法正常启动(0xc000007b)
安装提示vcruntime140.dll丢失
需重装vc++2015
下载地址:https://www.microsoft.com/zh-CN/download/details.aspx?id=48145
百度LBS云V3 云存储 云检索接口
<?php
/**
* 百度 LBS云图数据接口
* Author: IceCry <http://www.zhinizhiwo.com>
* Date: 2017-10-14 15:51
*
* 云存储使用V3 V4暂不支持云检索
* 暂不使用sn签名
* 百度LBS.云 http://lbsyun.baidu.com/index.php?title=lbscloud
*/
namespace ice;
class Bmap
{
private static $ak;
private static $tableid;
public function __construct($ak='', $tableid=0) {
if($ak===''){
die('ak required !');
}
self::$ak = $ak;
self::$tableid = $tableid;
}
/**
* 创建位置数据表
*
* @param <type> $name 中文表名
* @param integer $geotype 数据类型 1点 2线(暂不支持) 3面
* @param integer $is_published 是否发布到云检索 1自动发布到检索
*/
public function create_table($name, $geotype=1, $is_published=0, $sn='', $timestamp=0)
{
$url = 'http://api.map.baidu.com/geodata/v3/geotable/create';
$data = [
'ak' => self::$ak,
'name' => $name,
'geotype' => $geotype,
'is_published' => $is_published
];
$res = $this->https_request($url, $data);
return $res;
}
/**
* 查询表
*
* @param string $name 表名 可选
* @param string $sn 签名
*
* @return <type> ( description_of_the_return_value )
*/
public function search_table($name='', $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/geotable/list';
$data = [
'ak' => self::$ak,
'name' => $name
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 查询指定id表
*
* @param integer $id id
* @param string $sn sn
*
* @return <type> ( description_of_the_return_value )
*/
public function search_id($id=0, $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/geotable/detail';
$data = [
'ak' => self::$ak,
'id' => $id
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 修改表
*
* @param integer $id 表id
* @param integer $is_published 是否为云检索
* @param string $name 表名
* @param string $sn The serial number
*
* @return <type> ( description_of_the_return_value )
*/
public function update_table($id=0, $is_published=0, $name='', $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/geotable/update';
$data = [
'ak' => self::$ak,
'id' => $id,
'name' => $name,
'is_published' => $is_published,
'sn' => $sn
];
$res = $this->https_request($url, $data);
return $res;
}
/**
* 删除表 只能删除空表
*
* @param integer $id 表id
* @param string $sn The serial number
*/
public function delete_table($id=0, $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/geotable/delete';
$data = [
'ak' => self::$ak,
'id' => $id,
'sn' => $sn
];
$res = $this->https_request($url, $data);
return $res;
}
/**
* 创建/更新列
*
* @param string $name 中文列名
* @param string $key 列名
* @param integer $type 值类型 枚举值1:Int64, 2:double, 3:string, 4:在线图片url
* @param integer $max_length 最大长度 1-2048 type为string有效 汉字数
* @param string $default_value 默认值
* @param integer $is_sortfilter_field 是否排序筛选
* @param integer $is_search_field 是否文本检索
* @param integer $is_index_field 是否存储引擎的索引字段
* @param integer $is_unique_field 是否唯一索引
* @param string $sn 权限签名
*/
public function deal_column($id=0, $name='', $key='', $type=0, $max_length=0, $default_value='', $is_sortfilter_field=0, $is_search_field=0, $is_index_field=0, $is_unique_field=0, $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/column/create';
$data = [
'ak' => self::$ak,
'name' => $name,
'key' => $key,
'type' => $type,
'max_length' => $max_length,
'default_value' => $default_value,
'is_sortfilter_field' => $is_sortfilter_field,
'is_search_field' => $is_search_field,
'is_index_field' => $is_index_field,
'is_unique_field' => $is_unique_field,
'geotable_id' => self::$tableid,
'sn' => $sn
];
//如果存在id则更新
if($id){
$url = 'http://api.map.baidu.com/geodata/v3/column/update';
$data['id'] = $id;
}
$res = $this->https_request($url, $data);
return $res;
}
/**
* 查询列
*
* @param string $name 表名 可选
* @param string $key 属性key
* @param string $sn 签名
*
* @return <type> ( description_of_the_return_value )
*/
public function search_column($name='', $key='', $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/column/list';
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'name' => $name,
'key' => $key,
'sn' => $sn
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 查询指定id列数据
*
* @param integer $id The identifier
* @param string $sn The serial number
*/
public function search_column_id($id=0, $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/column/detail';
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'id' => $id,
'sn' => $sn
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 删除指定列
*
* @param integer $id 列id
* @param string $sn 签名
*
* @return <type> ( description_of_the_return_value )
*/
public function delete_column($id=0, $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/column/delete';
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'id' => $id,
'sn' => $sn
];
$res = $this->https_request($url, $data);
return $res;
}
/**
* 创建地理位置
*
* @param string $title poi名称
* @param string $address 地址
* @param string $tags 标签
* @param <type> $latitude 纬度
* @param <type> $longitude 经度
* @param integer $coord_type 坐标类型 1:GPS经纬度坐标 2:国测局加密经纬度坐标 3:百度加密经纬度坐标 4:百度加密墨卡托坐标
* @param string $diy 自定义数据
* @param string $sn 签名
* @param string $diyvalue 自定义唯一索引key
*/
public function deal_poi($id=0, $title='', $address='', $tags='', $latitude, $longitude, $coord_type=3, $diy=array(), $sn='', $diyvalue='')
{
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'title' => $title,
'address' => $address,
'tags' => $tags,
'latitude' => $latitude,
'longitude' => $longitude,
'coord_type' => $coord_type
];
$url = 'http://api.map.baidu.com/geodata/v3/poi/create';
if($id){
$url = 'http://api.map.baidu.com/geodata/v3/poi/update';
$data['id'] = $id;
}
$data = array_merge($data, $diy);
$res = $this->https_request($url, $data);
return $res;
}
/**
* 查询指定条件poi
*
* @param array $diy 自定义数据 is_index_field=1 string加$精准匹配
* @param string $title 标题
* @param string $tags 标签
* @param string $bounds 矩形区域
* @param integer $page_index 分页
* @param integer $page_size 页面大小
* @param string $sn 签名
*/
public function search_poi_list($diy=[], $title='', $tags='', $bounds='', $page_index=0, $page_size=10, $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/poi/list';
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'title' => $title,
'tags' => $tags,
'bounds' => $bounds,
'page_index' => $page_index,
'page_size' => $page_size
];
$data = array_merge($data, $diy);
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 查询指定id的数据
*
* @param integer $id id
* @param string $sn 签名
*
* @return <type> ( description_of_the_return_value )
*/
public function search_id_poi($id=0, $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/poi/detail';
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'id' => $id
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 删除poi 支持批量删除
*
* @param integer $id 删除单条 存在则其他条件无效
* @param string $diyvalue 自定义唯一索引
* @param string $ids 删除id列表1,2,3 批量删除尽可能使用此方法 <1000
* @param array $diyIndex 用户自定义 需设置is_index_field=1
* @param string $title 名称
* @param string $tags 标签
* @param string $bounds 矩形区域
* @param array $diyColumn 自定义
* @param integer $is_total_del 标记为批量删除 若仅设置为1不指定条件则删除全表
* @param string $sn 签名
*/
public function delete_poi($id=0, $diyvalue='', $ids='', $diyIndex=array(), $title='', $tags='', $bounds='', $diyColumn=array(), $is_total_del=0, $sn='')
{
$url = 'http://api.map.baidu.com/geodata/v3/poi/delete';
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'id' => $id,
'diyvalue' => $diyvalue,
'ids' => $ids,
'title' => $title,
'tags' => $tags,
'bounds' => $bounds,
'is_total_del' => $is_total_del
];
$arr = array_merge($diyIndex, $diyColumn);
$data = array_merge($data, $arr);
if(!$id){
unset($data['id']);
}
$res = $this->https_request($url, $data);
return $res;
}
/**
* 批量上传数据 暂无用 每日限调用25次
*/
public function create_multi_data()
{
$url = 'http://api.map.baidu.com/geodata/v3/poi/upload';
}
/**
* 批量上传进度查询接口 暂无用
*/
public function create_multi_progress()
{
$url = '';
}
/**
* 批量操作查询结果 暂无用
*/
public function multi_job_search()
{
}
/**
* 云检索 周边检索
*
* @param string $q 检索关键词
* @param string $location 经纬度
* @param integer $coord_type 坐标系 3百度经纬度
* @param integer $radius 检索半径
* @param string $tags 标签
* @param string $sortby 排序字段
* @param string $filter 过滤条件
* @param integer $page_index 分页索引
* @param integer $page_size 分页数量
* @param string $callback 回调函数
* @param string $sn
*
* @return <type> ( description_of_the_return_value )
*/
public function search_nearby($q='', $location='', $coord_type=3, $radius=1000, $tags='', $sortby='', $filter='', $page_index=0, $page_size=10, $callback='', $sn='')
{
$url = 'http://api.map.baidu.com/geosearch/v3/nearby';
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'q' => $q,
'location' => $location,
'coord_type' => $coord_type,
'radius' => $radius,
'tags' => $tags,
'sortby' => $sortby,
'filter' => $filter,
'page_index' => $page_index,
'page_size' => $page_size
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 云检索 本地检索
*
* @param string $q 查询字符
* @param integer $coord_type 坐标类型
* @param string $region 检索区域 默认全国
* @param string $tags 标签
* @param string $sortby 排序
* @param string $filter 过滤
* @param integer $page_index 分页索引
* @param integer $page_size 分页数量
* @param string $callback 回调函数
* @param string $sn The serial number
*/
public function search_local($q='', $coord_type=3, $region='', $tags='', $sortby='', $filter='', $page_index=0, $page_size=10, $callback='', $sn='')
{
$url = 'http://api.map.baidu.com/geosearch/v3/local';
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'q' => $q,
'coord_type' => $coord_type,
'region' => $region,
'tags' => $tags,
'sortby' => $sortby,
'filter' => $filter,
'page_index' => $page_index,
'page_size' => $page_size
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 云检索 矩形检索
*
* @param string $q 查询内容
* @param string $bounds 矩形区域
* @param string $tags The tags
* @param integer $coord_type The coordinate type
* @param string $sortby The sortby
* @param string $filter The filter
* @param integer $page_index The page index
* @param integer $page_size The page size
* @param string $callback The callback
* @param string $sn The serial number
*
* @return <type> ( description_of_the_return_value )
*/
public function search_bound($q='', $bounds='', $tags='', $coord_type=3, $sortby='', $filter='', $page_index=0, $page_size=10, $callback='', $sn='')
{
$url = 'http://api.map.baidu.com/geosearch/v3/bound';
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'q' => $q,
'bounds' => $bounds,
'tags' => $tags,
'coord_type' => $coord_type,
'sortby' => $sortby,
'filter' => $filter,
'page_index' => $page_index,
'page_size' => $page_size
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 云检索 poi详情检索
*
* @param integer $uid poi点的id值
* @param integer $coord_type The coordinate type
* @param string $sn The serial number
*
* @return <type> ( description_of_the_return_value )
*/
public function search_poi_detail($uid=0, $coord_type=3, $sn='')
{
$url = 'http://api.map.baidu.com/geosearch/v3/detail/'.$uid;
$data = [
'ak' => self::$ak,
'geotable_id' => self::$tableid,
'coord_type' => $coord_type
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* curl
*
* @param <type> $url The url
* @param <type> $data The data
* @param <type> $isget 是否为get请求
*
* @return <type> ( description_of_the_return_value )
*/
public function https_request($url, $data = null, $isget = false)
{
$headers = array(
'Cache-Control:no-cache',
'Pragma:no-cache'
);
if($isget){
$url .= '?';
if(is_array($data)){
$url .= http_build_query($data);
}elseif(is_string($data)) {
$url .= $data;
}
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_TIMEOUT,3);
if (!empty($data) && !$isget){
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$output = curl_exec($curl);
curl_close($curl);
return $output;
}
}
高德云图 云存储 云检索 数据接口
TP5 位置:/extends/ice/Amap.php 使用:use ice\Amap
<?php
/**
* 高德云图数据接口
* Author: IceCry <http://www.zhinizhiwo.com>
* Date: 2017-10-14 09:01
*/
namespace ice;
class Amap
{
private static $key;
private static $tableid;
public function __construct($key='', $tableid='') {
if($key===''){
die('key required !');
}
self::$key = $key;
self::$tableid = $tableid;
}
/**
* 创建云图数据表
*
* @param <type> $name 表名
* @param <type> $name 数字前面
*
* http://yuntuapi.amap.com/datamanage/table/create
* 返回值 status info tableid
*/
public function create_table($name='', $sig='')
{
$name = $name ? $name : date('YmdHis');
$url = "http://yuntuapi.amap.com/datamanage/table/create";
$data = [
'key' => self::$key,
'name' => $name,
'sig' => $sig
];
$res = $this->https_request($url, $data);
return $res;
}
/**
* 创建单条位置信息
*
* @param <type> $loctype 定位方式 1经纬度 2地址
* @param <type> $_location 经纬度
* @param <type> $_address 地址
* @param <type> $_name 数据名称
* @param <type> $coordtype 坐标类型 1: gps 2: autonavi 3: baidu
* @param <type> $sig 数字签名
* @param <type> $diy 用户自定义数据
*
* http://yuntuapi.amap.com/datamanage/data/create
* 返回值 status info _id
*/
public function deal_single_data($loctype=1, $_location='', $_address='', $_name='', $coordtype='3', $sig='', $diy=array(), $isUpdate=false)
{
$url = 'http://yuntuapi.amap.com/datamanage/data/create';
if($isUpdate){
$url = 'http://yuntuapi.amap.com/datamanage/data/update';
}
//基础信息 仅处理经纬度方式
$info = [
'_name' => $_name,
'_location' => $_location,
'coordtype' => $coordtype,
'_address' => $_address,
];
$info = json_encode(array_merge($info, $diy));
$data = [
'key' => self::$key,
'tableid' => self::$tableid,
'loctype' => $loctype,
'data' => $info
];
$res = https_request($url, $data);
return $res;
}
/**
* 暂无用 使用高德后台上传
*/
public function add_multi_data()
{
}
/**
* 删除单条/多条数据
*
* @param string $ids 数据1-50条 _id 1,3,4
* @param string $sig The signal
*
* 返回值 status info success fail成功/失败条数
*/
public function delete_data($ids='', $sig='')
{
$url = "http://yuntuapi.amap.com/datamanage/data/delete";
$data = [
'key' => self::$key,
'tableid' => self::$tableid,
'ids' => $ids,
'sig' => $sig
];
$res = $this->https_request($url, $data);
$res = json_decode($res);
return $res;
}
/**
* 获取批量处理进度 暂无用
*/
public function get_import_status()
{
}
/**
* 云检索 本地检索
*
* @param string $keywords 搜索关键词
* @param string $city 中文城市
* @param string $filter 过滤条件
* @param string $sortrule 排序规则
* @param string $limit 分页条数
* @param string $page 当前页
* @param string $sig 数字签名
*/
public function search_local($keywords=' ', $city='全国', $filter='', $sortrule='', $limit=10, $page=1, $sig='')
{
$url = 'http://yuntuapi.amap.com/datasearch/local';
$data = [
'key' => self::$key,
'tableid' => self::$tableid,
'keywords' => $keywords,
'city' => $city,
'filter' => $filter,
'sortrule' => $sortrule,
'limit' => $limit,
'page' => $page,
'sig' => $sig
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 云检索 周边检索
*
* @param string $keywords 搜索关键词
* @param string $center 中心经纬度
* @param string $radius 查询半径
* @param string $filter 过滤条件
* @param string $sortrule 排序规则
* @param string $limit 分页条数
* @param string $page 当前页
* @param string $sig 数字签名
*/
public function search_around($keywords=' ', $center='119.168162,36.713983', $radius='3000', $filter='', $sortrule='', $limit=10, $page=1, $sig='')
{
$url = 'http://yuntuapi.amap.com/datasearch/around';
$data = [
'key' => self::$key,
'tableid' => self::$tableid,
'keywords' => $keywords,
'center' => $center,
'radius' => $radius,
'filter' => $filter,
'sortrule' => $sortrule,
'limit' => $limit,
'page' => $page,
'sig' => $sig
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 多边形检索 暂无用
*/
public function search_polygon()
{
}
/**
* 云检索 id检索(poi详情检索)
*
* @param string $_id 地图数据id
* @param string $sig 数字签名
*
* @return <type> ( description_of_the_return_value )
*/
public function search_id($_id='', $sig='')
{
$url = 'http://yuntuapi.amap.com/datasearch/id';
$data = [
'key' => self::$key,
'tableid' => self::$tableid,
'_id' => $_id,
'sig' => $sig
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 云检索 按条件检索数据(可遍历整表数据)
*
* @param string $filter 过滤条件
* @param string $sortrule 排序规则
* @param string $limit 分页条数
* @param string $page 当前页
* @param string $sig 数字签名
*/
public function search_by_condition($filter='', $sortrule='', $limit=10, $page=1, $sig='')
{
$url = 'http://yuntuapi.amap.com/datamanage/data/list';
$data = [
'key' => self::$key,
'tableid' => self::$tableid,
'filter' => $filter,
'sortrule' => $sortrule,
'limit' => $limit,
'page' => $page,
'sig' => $sig
];
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* 云检索 数据分布检索
*
* @param string $keywords 搜索关键词
* @param string $center 中心经纬度
* @param string $radius 查询半径
* @param string $filter 过滤条件
* @param string $sortrule 排序规则
* @param string $limit 分页条数
* @param string $page 当前页
* @param string $sig 数字签名
*/
public function search_area_count($keywords=' ', $type='', $country='中国', $province='', $city='', $filter='', $sig='', $callback='cb')
{
$data = [
'key' => self::$key,
'tableid' => self::$tableid,
'filter' => $filter,
// 'callback' => $callback,
'sig' => $sig
];
switch ($type) {
case 'province':
$url = 'http://yuntuapi.amap.com/datasearch/statistics/province';
$data['country'] = $country;
break;
case 'city':
$url = 'http://yuntuapi.amap.com/datasearch/statistics/city';
$data['province'] = $province;
break;
case 'district':
$url = 'http://yuntuapi.amap.com/datasearch/statistics/district';
$data['province'] = $province;
$data['city'] = $city;
break;
default:
$url = '';
break;
}
$res = $this->https_request($url, $data, true);
return $res;
}
/**
* curl
*
* @param <type> $url The url
* @param <type> $data The data
* @param <type> $isget 是否为get请求
*
* @return <type> ( description_of_the_return_value )
*/
public function https_request($url, $data = null, $isget = false)
{
$headers = array(
'Cache-Control:no-cache',
'Pragma:no-cache'
);
if($isget){
$url .= '?';
if(is_array($data)){
$url .= http_build_query($data);
}elseif(is_string($data)) {
$url .= $data;
}
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_TIMEOUT,3);
if (!empty($data) && !$isget){
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$output = curl_exec($curl);
curl_close($curl);
return $output;
}
}
在CMD中查询不常见后缀域名Whois信息
很多小国、不常见的后缀域名,无法查询,比如查询qq.im域名,印度阿三的,查不到。推荐使用:Whois v1.14
微软介绍:http://technet.microsoft.com/en-us/Sysinternals/bb897435.aspx
下载解压,放于system32目录下,cmd执行Usage: whois [-v] domainname [whois.server]
用百度AI的OCR文字识别结合PHP实现了图片的文字识别功能
Thinkphp 整合 PHPWord生成docx文档
PHPOffice/PHPWord地址:https://github.com/PHPOffice/PHPWord
// $filename = iconv('utf-8', 'gb2312', $filename); //保存为中文名字