<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>zrqphp</title><link>http://www.zrqphp.com</link><description>专注于PHP研究,交流分享PHP技术</description><generator>Yourphpv2.2 Released</generator><lastBuildDate>Tue, 14 Apr 2026 08:20:46 GMT</lastBuildDate><webMaster>448687549@qq.com</webMaster><language>zh-cn</language><item><title>PHP,Mysql根据经纬度计算距离并排序</title><link>http://www.zrqphp.com/index.php?m=Article&amp;a=show&amp;id=32</link><description><![CDATA[/**<br />
&nbsp; &nbsp; &nbsp;* 接收页面传过来的经纬度，然后筛选出距离最近的商铺<br />
&nbsp; &nbsp; &nbsp;*/<br />
&nbsp; &nbsp; public function CooperativeStoreIn()<br />
&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; $data = [<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'latitude' =&gt; input('latitude'),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'longitude' =&gt; input('longitude')<br />
&nbsp; &nbsp; &nbsp; &nbsp; ];<br />
&nbsp; &nbsp; &nbsp; &nbsp; // PHP,Mysql根据经纬度计算距离并排序<br />
&nbsp; &nbsp; &nbsp; &nbsp; $sql&nbsp; = "select * from gf_cooperative_store order by ACOS(SIN(('".$data['latitude']."' * 3.1415) / 180 ) *SIN((latitude * 3.1415) / 180 ) +COS(('".$data['latitude']."' * 3.1415) / 180 ) * COS((latitude * 3.1415) / 180 ) *COS(('".$data['longitude']."' * 3.1415) / 180 - (longitude * 3.1415) / 180 ) ) * 6380 asc limit 30";<br />
&nbsp; &nbsp; &nbsp; &nbsp; $shops['datas'] = db('cooperative_store')-&gt;query($sql);<br />
&nbsp; &nbsp; &nbsp; &nbsp; $shops['status'] = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // 通过获取客户端经纬度坐标与店铺经纬度坐标计算距离，单位是KM<br />
&nbsp; &nbsp; &nbsp; &nbsp; foreach ($shops['datas'] as $key =&gt; $value) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $lat1 = $data['latitude'];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $lng1 = $data['longitude'];&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $lat2 = $value['latitude'];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $lng2 = $value['longitude'];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //将角度转为狐度<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $radLat1=deg2rad($lat1);//deg2rad()函数将角度转换为弧度<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $radLat2=deg2rad($lat2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $radLng1=deg2rad($lng1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $radLng2=deg2rad($lng2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $a=$radLat1-$radLat2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $b=$radLng1-$radLng2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $s=2*asin(sqrt(pow(sin($a/2),2)+cos($radLat1)*cos($radLat2)*pow(sin($b/2),2)))*6378.137; //return $s; 单位是km<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sd = round($s,2); //保留2位小数，四舍五入<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array_push($shops['datas'][$key],$sd);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; // echo db('cooperative_store')-&gt;getLastSql();<br />
&nbsp; &nbsp; &nbsp; &nbsp; $shops['datas'] = array_map(function($tag) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return array(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'distance' =&gt; $tag['0'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'address' =&gt; $tag['address'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'addtime' =&gt; $tag['addtime'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'content' =&gt; $tag['content'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'id' =&gt; $tag['id'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'latitude' =&gt; $tag['latitude'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'longitude' =&gt; $tag['longitude'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'status' =&gt; $tag['status'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'tel' =&gt; $tag['tel'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'thumbnail' =&gt; $tag['thumbnail'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'title' =&gt; $tag['title'],<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; }, $shops['datas']);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return json($shops);<br />
<p>
	&nbsp; &nbsp; }
</p>
<p>
	<img src="/Uploads/201810/5bc55b181aac7.jpg" alt="" /> 
</p>]]></description><pubDate>Tue, 16 Oct 2018 11:30:01 GMT</pubDate><author>yourphp</author></item><item><title>西部数码云主机 通过ip地址访问phpmyadmin</title><link>http://www.zrqphp.com/index.php?m=Article&amp;a=show&amp;id=31</link><description><![CDATA[<p>
	打开iis -<span>&gt;</span> 网站-<span>&gt;</span><span>找到Default Web Site-&gt;</span>ip解析或者域名解析即可
</p>]]></description><pubDate>Wed, 08 Feb 2017 18:10:21 GMT</pubDate><author>yourphp</author></item><item><title>wampserver配置多站点</title><link>http://www.zrqphp.com/index.php?m=Article&amp;a=show&amp;id=30</link><description><![CDATA[<p style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">
	1、在“httpd.conf”文件中查找：Include conf/extra/httpd-vhosts.conf，去掉前面的注释#。
</p>
<p style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">
	2、<span style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">在“httpd.conf”文件中配置好项目路径</span>
</p>
<p style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">
	<span style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;"><img src="/Uploads/201601/568e05921e509.jpg" alt="" /><span></span><br />
</span>
</p>
<p style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">
	<span>3、打开extra/httpd-vhosts.conf文件；在最后加入类似内容：（文件路径是自己安装程序的路径）</span>
</p>
<p style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">
	&lt;VirtualHost *:80&gt;<br />
&nbsp; &nbsp; ServerAdmin webmaster@dummy-host2.example.com<br />
&nbsp; &nbsp; DocumentRoot "D:/Work/project/2015/baoguang"<span style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">(这是你放程序的文件路径)</span><br />
&nbsp; &nbsp; ServerName www.baoguang.com<span style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">（这是自己定义的域名）</span><br />
&nbsp; &nbsp; ErrorLog "logs/dummy-host2.example.com-error.log"<br />
&nbsp; &nbsp; CustomLog "logs/dummy-host2.example.com-access.log" common<br />
&lt;/VirtualHost&gt;
</p>
<p style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">
	<img src="/Uploads/201601/568e0508072fb.jpg" alt="" /><span></span>
</p>
<p style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">
	4、<span>找到下图这个文件最后添加：</span>
	<p style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">
		127.0.0.1 &nbsp; www.<span style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">baoguang</span>.com &nbsp;&nbsp;（这是自己定义的域名）
	</p>
	<p style="color:#333333;font-family:'Microsoft Yahei', 微软雅黑, arial, 宋体, sans-serif;font-size:16px;text-align:justify;background-color:#FFFFFF;">
		<img src="/Uploads/201601/568e060fe88d9.jpg" alt="" />
	</p>
</p>]]></description><pubDate>Thu, 07 Jan 2016 14:30:44 GMT</pubDate><author>邹润全</author></item><item><title>ThinkCmf 获取一级栏目导航</title><link>http://www.zrqphp.com/index.php?m=Article&amp;a=show&amp;id=29</link><description><![CDATA[<pre class="prettyprint lang-php">&lt;?php
    $where['status'] = array('eq', 1);
    $where['id'] = array('neq', 1);
    $navs = M('nav')-&gt;where($where)-&gt;field('label,href')-&gt;select();

    // 开始
&nbsp; &nbsp; foreach ($navs as $key=&gt;$nav){
&nbsp; &nbsp; &nbsp; &nbsp; $href=htmlspecialchars_decode($nav['href']);
&nbsp; &nbsp; &nbsp; &nbsp; $hrefold=$href;
&nbsp; &nbsp; &nbsp; &nbsp; if(strpos($hrefold,"{")){//序列 化的数据
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $href=unserialize(stripslashes($nav['href']));
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $default_app=strtolower(C("DEFAULT_MODULE"));
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $href=strtolower(leuu($href['action'],$href['param']));
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $g=C("VAR_MODULE");
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $href=preg_replace("/$g=$default_app&amp;/", "",$href);
&nbsp; &nbsp; &nbsp; &nbsp; }else{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $href=$hrefold;
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; $nav['href']=$href;
&nbsp; &nbsp; &nbsp; &nbsp; $navs[$key]=$nav;
&nbsp; &nbsp; }
&nbsp; &nbsp; // 结束
?&gt;

&lt;volist name="navs" id="r"&gt;
     &lt;li&gt;&lt;a href="{$r.href}"&gt;{$r.label}&lt;/a&gt;&lt;/li&gt;
&lt;/volist&gt;</pre>]]></description><pubDate>Mon, 04 Jan 2016 17:40:44 GMT</pubDate><author>邹润全</author></item><item><title>xampp 配置多域名方法</title><link>http://www.zrqphp.com/index.php?m=Article&amp;a=show&amp;id=28</link><description><![CDATA[<p>
	<br />
</p>
<pre class="prettyprint lang-php">1、D:\xampp\apache\conf 路径   找到 httpd.conf 文件  第238   239行默认路径，改为自己项目对应路径    DocumentRoot "D:/Work/project/2015"    &lt;Directory "D:/Work/project/2015"&gt;
2、D:\xampp\apache\conf\extra 路径 找到 httpd-vhosts.conf 文件 修改如下：（对应自己的项目路径，和配置多域名，多个项目，复制即可）
&lt;VirtualHost *:80&gt;
    ServerName www.test.com
    DocumentRoot "D:/Work/project/2015/thinkcmf"
    &lt;Directory "D:/Work/project/2015/thinkcmf"&gt;
        Order allow,deny
        Allow from all
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;</pre>
<span></span>
<p>
	<br />
</p>
<p>
	<img src="/Uploads/201511/564d8baa5674d.jpg" alt="" /><span></span>
</p>
<p>
<pre class="prettyprint lang-php">3、C:\Windows\System32\drivers\etc 路径，找到 hosts 文件 配置对应域名即可 127.0.0.1       www.thinkcmf.com    127.0.0.1       www.lovecar.com</pre>
</p>]]></description><pubDate>Thu, 19 Nov 2015 16:43:47 GMT</pubDate><author>yourphp</author></item><item><title>离别总是让人伤心</title><link>http://www.zrqphp.com/index.php?m=Article&amp;a=show&amp;id=26</link><description><![CDATA[<div style="text-align:center;">
	<img src="/Uploads/201508/55c858dc63e1b.gif" alt="" />
</div>]]></description><pubDate>Mon, 10 Aug 2015 15:55:21 GMT</pubDate><author>yourphp</author></item><item><title>【青春的歌者】李晓：晚晚</title><link>http://www.zrqphp.com/index.php?m=Article&amp;a=show&amp;id=25</link><description><![CDATA[<div style="text-align:center;">
	<embed src="http://player.youku.com/player.php/sid/XOTM2NzY5NzI4/v.swf" type="application/x-shockwave-flash" width="914" height="600" quality="high" />
</div>]]></description><pubDate>Tue, 21 Apr 2015 10:06:03 GMT</pubDate><author>优酷</author></item><item><title>YourPHP在首页提交留言返回首页错乱问题</title><link>http://www.zrqphp.com/index.php?m=Article&amp;a=show&amp;id=24</link><description><![CDATA[只需要把/Yourphp/Tpl/Home/Default下的layout Home_header <span>Index_</span>index <span>Home_</span>footer 都复制一份<br />
上传到 /Yourphp/Tpl/User/Default下<br />]]></description><pubDate>Thu, 19 Mar 2015 11:14:03 GMT</pubDate><author>yourphp</author></item><item><title>Yourphp自定义导航方法</title><link>http://www.zrqphp.com/index.php?m=Article&amp;a=show&amp;id=23</link><description><![CDATA[可以subcat标签实现代码如下：<span></span><br />
<br />
&lt;div id="nav"&gt;&lt;ul&gt;<br />
&nbsp; &lt;YP:subcat &nbsp;catid="0"&gt;&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;li{if $r[id]==$bcid} class="on"{/if}&gt;&lt;a href="{$r.url}"&gt;{$r.catname}&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{if $r['child']==1} &lt;ul&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;YP:subcat &nbsp;catid="$r[id]" id="res"&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;li&gt;&lt;a href="{$res.url}"&gt;{$res.catname}&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/YP:subcat&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/ul&gt;{/if}&nbsp;<br />
&nbsp; &lt;/YP:subcat&gt;<br />
&lt;/ul&gt;&lt;/div&gt;&nbsp;<br />
<br />
其中<br />
{if $r[id]==$bcid} class="on"{/if}<br />
是判断当前访问的大栏目为高亮显示的。<br />]]></description><pubDate>Tue, 03 Mar 2015 14:43:45 GMT</pubDate><author>邹润全</author></item><item><title>YOURPHP volist 排序</title><link>http://www.zrqphp.com/index.php?m=Article&amp;a=show&amp;id=22</link><description><![CDATA[修改基础类 222行 把-&gt;order('createtime desc,id desc')   改为-&gt;order('listorder desc') &nbsp; &nbsp; &nbsp; &nbsp; 就是这样了 很简单。BaseAction.class.php这个文件]]></description><pubDate>Thu, 12 Feb 2015 12:19:04 GMT</pubDate><author>邹润全</author></item></channel></rss>
