- 博客(12)
- 收藏
- 关注
原创 mysql忘记原密码,重新设置密码
vi /etc/my.cnf在mysqld下面加skip-grant-tablesservice mysql restartmysqld -u root -puse mysql;update mysql.user set authentication_string=password("123123") where user='root';flush privileges;ex...
2019-11-09 16:06:08
207
原创 laravel Mysql 按距離排序
$model = DB::table('table_name')->select('');$model->addSelect(\DB::raw("acos(cos(" . $lat . "*pi()/180)*cos(lat*pi()/180)*cos(" . $lng . "*pi()/180-lng*pi()/180)+sin(" . $lat . "*pi()/180)*sin...
2018-07-31 17:58:01
1342
转载 根據經緯度計算兩點距離
function getDistance($lat1, $lng1, $lat2, $lng2){ $earthRadius = 6367000; //approximate radius of earth in meters $lat1 = ($lat1 * pi() ) / 180; $lng1 = ($lng1 * pi() ) / 180;...
2018-07-28 16:29:42
241
原创 根據經緯度獲取範圍
function getLatAndLngRange($Lat,$Lng,$size){ $range = 180 / pi() * $size / 6367; //周圍$size千米 $lngR = $range / cos($Lat * pi() / 180); $maxLat= $Lat + $range;//最大纬度 ...
2018-07-28 16:29:17
188
原创 根據地址獲取經緯度
function getLatAndLng($address){ if (!is_string($address))die("All Addresses must be passed as a string"); $_result = file_get_contents('http://maps.google.cn/maps/api/geocode/json?add...
2018-07-28 16:28:52
148
转载 编写函数取得上一月的最后一天
<?php date_default_timezone_set('PRC'); /** * 获取给定月份的上一月最后一天 * @param $date string 给定日期 * @return string 上一月最后一天 */ function get_last_month_last_day($date = ''){ ...
2018-07-28 16:28:15
526
转载 写一个函数,算出两个文件的相对路径,如[Math Processing Error]a=′/a/b/c/d/e.php′;b='/a/b/12/34/c.php';计算出[Math Processin
<?php function releative_path($path1,$path2){ $arr1 = explode("/",dirname($path1)); $arr2 = explode("/",dirname($path2)); for ($i=0,$len = count($arr2); $i < $len; $...
2018-07-28 16:27:36
915
转载 简述论坛中无限分类的实现原理
创建类别表如下:CREATE TABLE category(cat_id smallint unsigned not null auto_increment primary key comment'类别ID',cat_name VARCHAR(30)NOT NULL DEFAULT''COMMENT'类别名称',parent_id SMALLINT UNSIGNED NOT NULL D...
2018-07-28 16:27:07
600
转载 从一个标准url里取出文件的扩展名,例如:https://office.techrare.com/memecoinsapi/public/swagger/merchant.html需要取出html或.
<?php // 方案一 function getExt1($url){ $arr = parse_url($url); //Array ( [scheme] => http [host] => www.sina.com.cn [path] => /abc/de/fg.php [query] => id=1 ) ...
2018-07-28 16:26:16
537
转载 一个能创建多级目录的PHP函数
<?php /** * 创建多级目录 * @param $path string 要创建的目录 * @param $mode int 创建目录的模式,在windows下可忽略 */ function create_dir($path,$mode = 0777) { if (is_dir($path)) { ...
2018-07-28 16:25:06
506
原创 URL重写规则的用意
<IfModulemod_rewrite.c>RewriteEngineonRewriteCond%{REQUEST_FILENAME}!-fRewriteCond%{REQUEST_FILENAME}!-dRewriteBase/RewriteRule./index.php[L]</IfModule>如果REQUEST_FILENAME文件存在,就直接访...
2018-07-28 16:19:04
377
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人