<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>运达&#039;s  blog &#187; Thinkphp</title>
	<atom:link href="https://www.yunda51.com/?cat=16&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://www.yunda51.com</link>
	<description>运达的博客</description>
	<lastBuildDate>Wed, 12 Nov 2025 07:58:26 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0.19</generator>
	<item>
		<title>linux下Thinkphp6+workerman+gateway基本简介与环境搭建</title>
		<link>https://www.yunda51.com/?p=1942</link>
		<comments>https://www.yunda51.com/?p=1942#comments</comments>
		<pubDate>Tue, 13 Sep 2022 10:57:11 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[php技术]]></category>
		<category><![CDATA[Thinkphp]]></category>
		<category><![CDATA[socket]]></category>
		<category><![CDATA[Thinkphp6]]></category>
		<category><![CDATA[workman]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=1942</guid>
		<description><![CDATA[1、Composer安装与基本使用 https://docs.phpcomposer.com/00-intro<a href="https://www.yunda51.com/?p=1942" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<h2>1、Composer安装与基本使用</h2>
<p><a href="https://docs.phpcomposer.com/00-intro.html">https://docs.phpcomposer.com/00-intro.html</a></p>
<p>1）、下载</p>
<pre class="wp-code-highlight prettyprint"># curl -sS https://getcomposer.org/installer | php
</pre>
<p>或者</p>
<pre class="wp-code-highlight prettyprint"># php -r &quot;copy(&#039;https://install.phpcomposer.com/installer&#039;, &#039;composer-setup.php&#039;);
# php composer-setup.php
</pre>
<p>2）、移动 composer.phar，以便 composer 能进行全局调用：</p>
<pre class="wp-code-highlight prettyprint"># mv composer.phar /usr/local/bin/composer
</pre>
<p>3）、切换为国内镜像：</p>
<pre class="wp-code-highlight prettyprint"># composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
</pre>
<p>4）、更新 composer：</p>
<pre class="wp-code-highlight prettyprint"># composer selfupdate
</pre>
<p>https://docs.phpcomposer.com/01-basic-usage.html</p>
<p><strong>2、安装thinkphp6</strong></p>
<p>安装稳定版</p>
<pre class="wp-code-highlight prettyprint">composer create-project topthink/think tp6
</pre>
<p><a href="http://www.yunda51.com/wp-content/uploads/2022/09/1.png"><img class="alignnone size-full wp-image-1943" src="http://www.yunda51.com/wp-content/uploads/2022/09/1.png" alt="1" width="830" height="160" /></a><br />
查看配置文件是否禁用了proc_open函数</p>
<p>putenv</p>
<hr />
<p><a href="http://www.yunda51.com/wp-content/uploads/2022/09/2.png"><img class="alignnone size-full wp-image-1944" src="http://www.yunda51.com/wp-content/uploads/2022/09/2.png" alt="2" width="830" height="386" /></a><br />
<a href="http://www.yunda51.com/wp-content/uploads/2022/09/3.png"><img class="alignnone size-full wp-image-1945" src="http://www.yunda51.com/wp-content/uploads/2022/09/3.png" alt="3" width="830" height="838" /></a></p>
<p><strong>安全PHP要求&gt;=7.1.0</strong></p>
<p><strong>3、Workerman简介与安装</strong></p>
<pre class="wp-code-highlight prettyprint">简介：引用官方的
Workerman是一款纯PHP开发的开源高性能的PHP socket 服务器框架。被广泛的用于手机app、手游服务端、网络游戏服务器、聊天室
服务器、硬件通讯服务器、智能家居、车联网、物联网等领域的开发。 支持TCP长连接，支持Websocket、HTTP等协议，支持自定义协议。
基于workerman开发者可以更专注于业务逻辑开发，不必再为PHP Socket底层开发而烦恼。
</pre>
<p>其它介绍</p>
<p>http://doc.workerman.net/</p>
<p>http://doc2.workerman.net/</p>
<p>https://web.popoim.cn/im/web</p>
<p>https://demo.popoim.cn/im/h5/</p>
<p>安装：</p>
<pre class="wp-code-highlight prettyprint">composer require topthink/think-worker
</pre>
<p>安装gateway-worker<br />
<a href="http://www.yunda51.com/wp-content/uploads/2022/09/4.png"><img src="http://www.yunda51.com/wp-content/uploads/2022/09/4.png" alt="4" width="828" height="146" class="alignnone size-full wp-image-1946" /></a></p>
<p>须要安装fileinfo扩展<br />
<a href="http://www.yunda51.com/wp-content/uploads/2022/09/5.png"><img src="http://www.yunda51.com/wp-content/uploads/2022/09/5.png" alt="5" width="830" height="582" class="alignnone size-full wp-image-1947" /></a></p>
<p><strong>4、运行workerman作为服务端（socketServer）</strong></p>
<pre class="wp-code-highlight prettyprint">
php think worker:server
</pre>
<p><a href="http://www.yunda51.com/wp-content/uploads/2022/09/6.png"><img src="http://www.yunda51.com/wp-content/uploads/2022/09/6.png" alt="6" width="830" height="492" class="alignnone size-full wp-image-1948" /></a></p>
<p>pcntl相关函数</p>
<p>https://www.php.net/manual/zh/book.pcntl.php</p>
<p><strong>5、连接websocket</strong><br />
客户端代码 ：</p>
<pre class="wp-code-highlight prettyprint">
ws = new WebSocket(&quot;ws://xxx.xxx.xxx.xxx:9999&quot;);
ws.onopen = function() {
    alert(&quot;连接成功&quot;);
    ws.send(&#039;tom&#039;);
    alert(&quot;给服务端发送一个字符串：tom&quot;);
};
ws.onmessage = function(e) {
    alert(&quot;收到服务端的消息：&quot; + e.data);
};

</pre>
<p>连接不上的原因十有八九<br />
防火墙命令：<br />
查看状态：systemctl status firewalld.service<br />
关闭firewall：systemctl stop firewalld.service<br />
启动：systemctl start firewalld.service<br />
重启：systemctl restart firewalld.service</p>
<p>查看已开放端口：<br />
firewall-cmd --list-ports<br />
开放端口：<br />
firewall-cmd --zone=public --add-port=9999/tcp --permanent</p>
<pre class="wp-code-highlight prettyprint">
–zone #作用域
–add-port=80/tcp #添加端口，格式为：端口/通讯协议
–permanent #永久生效，没有此参数重启后失效
</pre>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=1942</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php ios 推送实例 + iospush.class.php类</title>
		<link>https://www.yunda51.com/?p=1322</link>
		<comments>https://www.yunda51.com/?p=1322#comments</comments>
		<pubDate>Tue, 17 Jun 2014 03:37:24 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[php技术]]></category>
		<category><![CDATA[Thinkphp]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[推送]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=1322</guid>
		<description><![CDATA[下载：ios推送实例和类 解析一个推送通知 你的服务器负责创建一个推送通知消息，所以了解一个推送通知消息的构成<a href="https://www.yunda51.com/?p=1322" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p><strong><a href="http://pan.baidu.com/s/1dDmtFOH" target=_blank>下载：ios推送实例和类</a></strong></p>
<div class="buy shortcodestyle">
解析一个推送通知<br />
你的服务器负责创建一个推送通知消息，所以了解一个推送通知消息的构成是有必要的。<br />
如果一个推送通知的payload超过了256个字节，那么这个推送就不会被“APNS”接受。<br />
一个推送通知是一个短信息，由“device token”，“payload–负载内容”，和其他的一些字节组成。“payload–负载内容”是我们感兴趣的部分，因为它包含着我们实际想发送出去的数据。<br />
你的服务器必须提供“payload–负载内容”，它是以JSON的字典的数据格式来组织数据的。下面是一个很简单的推送消息payload：<br />
{<br />
“aps”:<br />
{<br />
“alert”: “Hello, world!”,<br />
“sound”: “default”<br />
}<br />
}<br />
对于不了解JSON的人，一个block的划分由一对花括号“{}”包裹，其中包含一个由“键/值 (key/value)”对组成的“字典”，(就像NSDictionary)。<br />
“payload–负载内容”就是一个“字典”，包含了至少一个“aps”项，“aps”本身也是一个“字典”。在我们的例子中，“aps”包含“alert”和“sound”字段。当这个推送通知被接收后，它将显示一个包含“Hello, world!”内容的提醒框，并且播放标准的提示音。<br />
你可以向“aps”添加另外的选项，来配置通知，例如<br />
{<br />
“aps”:<br />
{<br />
“alert”:<br />
{<br />
“action-loc-key”: “Open”,<br />
“body”: “Hello, world!”<br />
},<br />
“badge”: 2<br />
}<br />
}<br />
现在“alert”是一个字典。”action-loc-key” 对应的value替代了“View”按钮上的文本内容，”badge”字段包含的数字将被显示在应用图标上，这个通知不会播放提示音。
</div>
<pre class="wp-code-highlight prettyprint">
&lt;?php
     //ios推送
     require_once ( &quot;./iospush.class.php&quot; ) ;
     //证书，IOS开发人员提供的, 还有一个密码，配置在 iospush.php 上
     $pem = &#039;./ck.pem&#039;;
    //token 用连接工具连接上了，看看设备信息就可以查看  测试请修改为正确的 token
    $ios_token = &#039;82eba403a347861e7d0ec0d160e140fbb216c64a6518ed87dcf260c65931aa63&#039;;
    //我们定义的数据
    $pusharr = array(
	&#039;description&#039;=&gt;&#039;test_push&#039;,
	&#039;key1&#039;=&gt;&#039;value1&#039;,
	&#039;key2&#039;=&gt;&#039;value2&#039;,
    );
    $iospush = new iospush($pem,&#039;123456&#039;);
    $push = $iospush-&gt;push($ios_token,$pusharr);
    var_dump($push );
?&gt;
</pre>
<pre class="wp-code-highlight prettyprint">
&lt;?php
/**
 * PHP iospush
 *
 * Copyright (c) 2006 - 2014 iospush
 *
 *
 * @category   PHP iospush
 * @copyright  Copyright (c) iospush (http://www.leipi.org)
 * @license    http://www.apple.com    LGPL
 * @version    1.8.0, 2014-03-02
 */
class iospush
{
	public $path=&#039;ck.pem&#039;;//证书
	public $pass=&#039;123456&#039;; //证书密码
	public $sound = &#039;tap.aif&#039;; //通知声
	public $badge=0;
	
	public function __construct($path=&#039;&#039;,$pass=&#039;&#039;) {
		if($path)
			$this-&gt;path = $path;
		if($pass)
			$this-&gt;pass = $pass;

	}
	function push($token, $data)
	{
		
		// Construct the notification payload
		$body = array();
		if ($this-&gt;badge) {
			$body[&#039;aps&#039;][&#039;badge&#039;] = $this-&gt;badge;
		} 
		$body[&#039;aps&#039;][&#039;alert&#039;] = $data[&#039;description&#039;];
		$body[&#039;aps&#039;][&#039;sound&#039;] = $this-&gt;sound; 
		// 组装数据
		foreach($data as $k =&gt; $v) {
			if ($k != &quot;description&quot;) {
				$body[$k] = $v;
			} 
		} 
		
		// $body[&#039;append_1&#039;]=&quot;appendent_1&quot;;
		// $body[&#039;append_2&#039;]=&quot;appendent_2&quot;;
		$ctx = stream_context_create();
		stream_context_set_option($ctx, &#039;ssl&#039;, &#039;local_cert&#039;, $path); //pem文件地址
		stream_context_set_option($ctx, &#039;ssl&#039;, &#039;passphrase&#039;, $this-&gt;pass); //证书密码
		 
		// $fp=stream_socket_client(&#039;ssl://gateway.push.apple.com:2195&#039;, $err, $errstr, 60,                  STREAM_CLIENT_CONNECT, $ctx);//正式
		$fp = @stream_socket_client(&quot;ssl://gateway.sandbox.push.apple.com:2195&quot;, $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx); //测试沙箱
		
		if (!$fp) {
			return false;
		} 

		$payload = json_encode($body);
		$msg = chr(0) . pack(&quot;n&quot;, 32) . pack(&#039;H*&#039;, str_replace(&#039; &#039;, &#039;&#039;, $token)) . pack(&quot;n&quot;, strlen($payload)) . $payload;

		fwrite($fp, $msg);
		fclose($fp);
		return true;
	} 
}
?&gt;
</pre>
<p>转载请注明转自:<a href="http://www.yunda51.com">运达's blog</a>  原文地址：<a href="http://www.yunda51.com/1322.html">http://www.yunda51.com/1322.html</a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=1322</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ajax表单验证</title>
		<link>https://www.yunda51.com/?p=1295</link>
		<comments>https://www.yunda51.com/?p=1295#comments</comments>
		<pubDate>Thu, 08 May 2014 03:04:04 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[php技术]]></category>
		<category><![CDATA[Thinkphp]]></category>
		<category><![CDATA[Ajax]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=1295</guid>
		<description><![CDATA[最近没什么可以的了,只能随便凑点东西了哈~~ ajax表单验证,测试过的,直接代码了! &#60;div cla<a href="https://www.yunda51.com/?p=1295" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>最近没什么可以的了,只能随便凑点东西了哈~~ ajax表单验证,测试过的,直接代码了!</p>
<pre class="wp-code-highlight prettyprint">
   &lt;div class=&quot;bdbox&quot;&gt;
        &lt;ul&gt;  
	    &lt;li&gt;&lt;span class=&quot;bdl&quot;&gt;&lt;em&gt;*&lt;/em&gt;企业名称:&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;bdr&quot;&gt;&lt;input id=&quot;companynames&quot; name=&quot;companyname&quot; size=&quot;30&quot; class=&quot;txt&quot; /&gt;&lt;/span&gt;&lt;/li&gt;
            &lt;li&gt;&lt;span class=&quot;bdl&quot;&gt;&lt;em&gt;*&lt;/em&gt;企业网址:&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;bdr&quot;&gt;&lt;input id=&quot;companyurls&quot; name=&quot;companyurl&quot; size=&quot;30&quot; class=&quot;txt&quot; /&gt;&lt;/span&gt;&lt;/li&gt;
            &lt;li&gt;&lt;span class=&quot;bdl&quot;&gt;&lt;em&gt;*&lt;/em&gt;您的称呼:&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;bdr&quot;&gt;&lt;input id=&quot;names&quot; name=&quot;name&quot; size=&quot;30&quot; class=&quot;txt&quot; /&gt;&lt;/span&gt;&lt;/li&gt;
	    &lt;li&gt;&lt;span class=&quot;bdl&quot;&gt;&lt;em&gt;*&lt;/em&gt;您的手机:&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;bdr&quot;&gt;&lt;input id=&quot;phones&quot; name=&quot;phone&quot; size=&quot;30&quot; class=&quot;txt&quot; /&gt;&lt;/span&gt;&lt;/li&gt;
	    &lt;li class=&quot;gaob&quot;&gt;&lt;span class=&quot;bdl&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;备注留言:&lt;/span&gt;&lt;span class=&quot;bdr&quot;&gt;&lt;textarea id=&quot;notes&quot; name=&quot;note&quot; rows=&quot;3&quot; cols=&quot;26&quot; onfocus=&quot;if(value==&#039;请填写您想说的其他内容！&#039;) {value=&#039;&#039;}&quot; onblur=&quot;if (value ==&#039;&#039;){value=&#039;请填写您想说的其他内容！&#039;}&quot;&gt;请填写您想说的其他内容！&lt;/textarea&gt;&lt;/span&gt;&lt;/li&gt;
	    &lt;li class=&quot;gaoc&quot;&gt;
            &lt;input id=&quot;wfsubmits&quot; type=&quot;image&quot; src=&quot;__PUBLIC__/images/lijishenqing.jpg&quot; 
           onclick=&quot;customerAdds()&quot; name=&quot;wfsubmits&quot; value=&quot;&quot; class=&quot;send&quot; /&gt;
	   &lt;input type=&quot;hidden&quot; value=&quot;&quot; name=&quot;web_ref&quot; id=&quot;web_ref&quot; /&gt;
	    &lt;/li&gt;
        &lt;/ul&gt;	
   &lt;/div&gt;  	
</pre>
<pre class="wp-code-highlight prettyprint">
&lt;script type=&quot;text/javascript&quot;&gt;
      function customerAdds(){
	  $(&quot;#wfsubmits&quot;).attr(&#039;disabled&#039;,&#039;disabled&#039;);
	  var companyname=$(&quot;#companynames&quot;).val();
	  var companyurl=$(&quot;#companyurls&quot;).val();
	  var name=$(&quot;#names&quot;).val();
	  var phone=$(&quot;#phones&quot;).val();
	  var note=$(&quot;#notes&quot;).val();
	
	  if(companyname == &#039;&#039;){
		ui.error(&quot;企业名称不能为空！&quot;);
		$(&quot;#wfsubmits&quot;).removeAttr(&#039;disabled&#039;);
		return false;
	  }
	  if(name == &#039;&#039;){
		ui.error(&quot;您的称呼不能为空！&quot;);
		$(&quot;#wfsubmits&quot;).removeAttr(&#039;disabled&#039;);
		return false;
	  }
	 if(phone == &#039;&#039;){
		ui.error(&quot;手机号码不能为空！&quot;);
		$(&quot;#wfsubmits&quot;).removeAttr(&#039;disabled&#039;);
		return false;
	 }else if(isPhone(phone)==false){
		ui.error(&quot;手机号码格式不正确！&quot;);
		$(&quot;#wfsubmits&quot;).removeAttr(&#039;disabled&#039;);
		return false;
	 }
	 $.post(&quot;{:U(&#039;Home/Index/ajaxAddCustomer&#039;)}&quot;,{companyname:companyname,companyurl:companyurl,name:name,phone:phone,note:note},function(res){
		if(res&gt;0) {
			$(&quot;#companynames&quot;).val(&#039;&#039;);
			$(&quot;#companyurls&quot;).val(&#039;&#039;);
			$(&quot;#names&quot;).val(&#039;&#039;);
			$(&quot;#phones&quot;).val(&#039;&#039;);
			$(&quot;#notes&quot;).val(&#039;&#039;);
			ui.success(&#039;提交成功&#039;);
		}else {
			ui.error(&#039;提交失败&#039;);
		}
		$(&quot;#wfsubmits&quot;).removeAttr(&#039;disabled&#039;);
	});
}
     function isPhone(str){
          var re=/^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}?$|15[0-9]\d{8}?$|18[0-9]\d{8}?$/; 
	  if (re.test(str) != true) {
		return false;
	  }else{
		return true;
	}	
  }
&lt;/script&gt;
</pre>
<p>转载请注明转自:<a href="http://www.yunda51.com">运达's blog</a>  原文地址：<a href="http://www.yunda51.com/1295.html">http://www.yunda51.com/1295.html</a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=1295</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>thinkphp如何导出Excel</title>
		<link>https://www.yunda51.com/?p=1204</link>
		<comments>https://www.yunda51.com/?p=1204#comments</comments>
		<pubDate>Wed, 12 Feb 2014 05:30:03 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[php技术]]></category>
		<category><![CDATA[Thinkphp]]></category>
		<category><![CDATA[Excl]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=1204</guid>
		<description><![CDATA[用php导出Excel,这样更能清楚明了!废话不多说了,直接代码! /*导出xls用户个人信息*/ funct<a href="https://www.yunda51.com/?p=1204" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>用php导出Excel,这样更能清楚明了!废话不多说了,直接代码!</p>
<pre class="wp-code-highlight prettyprint">
/*导出xls用户个人信息*/
function export(){   		  
	      header(&quot;Content-type:application/octet-stream&quot;);
              header(&quot;Accept-Ranges:bytes&quot;);
              header(&quot;Content-type:application/vnd.ms-excel&quot;);  
              header(&quot;Content-Disposition:attachment;filename=用户信息表&quot;.date(&quot;Y-m-d&quot;).&quot;.xls&quot;);
              header(&quot;Pragma: no-cache&quot;);
              header(&quot;Expires: 0&quot;);
              //导出xls 开始
	      $tag0 = iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;,&#039;用户ID&#039;);
              $tag1 = iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;,&#039;用户名&#039;);
              $tag2 = iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;,&#039;待领取&#039;);
	      $tag3 = iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;,&#039;奖金总数&#039;);
	      $tag4 = iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;,&#039;开户行&#039;);
	      $tag5 = iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;,&#039;开户城市&#039;);
	      $tag6 = iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;,&#039;开户行地址&#039;);
	      $tag7 = iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;,&#039;银行卡号&#039;);
	      $tag8 = iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;,&#039;持卡人姓名&#039;);
	      echo &quot;$tag0\t$tag1\t$tag2\t$tag3\t$tag4\t$tag5\t$tag6\t$tag7\n&quot;;
	      ////查询的一张表
//$arr=M (&#039;textpage&#039;)-&gt;field(&#039;username,count(id) as allcount,sum(price) as allprice &#039;)-&gt;group(&#039;username&#039;)-&gt;select();
$field=&quot;crowd_textpage.tid,crowd_textpage.username,users.bankName,users.city,users.bankAddress,
users.bankCard,users.bankUsr,count(crowd_textpage.id) as allcount,sum(crowd_textpage.price) as allprice&quot;;
		$arr = M (&#039;textpage&#039;)-&gt;field($field)
				     -&gt;join(&#039;crowd_user as users ON crowd_textpage.username=users.username&#039;)
				     -&gt;group(&#039;crowd_textpage.username&#039;)
				     -&gt;select();			  
			  //dump(M (&#039;textpage&#039;)-&gt;getLastSql());die;	   			  
			  foreach($arr as $key=&gt;$val){
			  //$date        =    date(&#039;Y-m-d&#039;,$val[&#039;pay_time&#039;]);
			  $tid    =    iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;, $val[&#039;tid&#039;]);
			  $tid=$tid?$tid:&#039;-&#039;;
			  $username    =    iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;, $val[&#039;username&#039;]);
			  $username=$username?$username:&#039;-&#039;;
			  $allcount    =    iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;, $val[&#039;allcount&#039;]);
			  $allcount=$allcount?$allcount:&#039;-&#039;;
			  $allprice    =    iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;, $val[&#039;allprice&#039;]);
			  $allprice=$allprice?$allprice:&#039;-&#039;;
			  $bankName    =    iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;, $val[&#039;bankName&#039;]);
			  $bankName=$bankName?$bankName:&#039;-&#039;;
			  $city    =    iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;, $val[&#039;city&#039;]);
			  $city=$city?$city:&#039;-&#039;;
			  $bankAddress    =    iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;, $val[&#039;bankAddress&#039;]);
			  $bankAddress=$bankAddress?$bankAddress:&#039;-&#039;;
			  $bankCard    =    iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;, $val[&#039;bankCard&#039;]);
			  $bankCard=$bankCard?$bankCard:&#039;-&#039;;
			  $bankUsr    =    iconv(&quot;UTF-8&quot;, &quot;GB2312&quot;, $val[&#039;bankUsr&#039;]);
		          $bankUsr=$bankUsr?$bankUsr:&#039;-&#039;;
			  echo &quot;$tid\t$username\t$allcount\t$allprice\t$bankName\t$city
\t$bankAddress\t&#039;$bankCard\t$bankUsr\n&quot;;
		}
} 
</pre>
<p>这样就ok了!<br />
转载请注明转自:<a href="http://www.yunda51.com">运达's blog</a>  原文地址：<a href="http://www.yunda51.com/1204.html">http://www.yunda51.com/1204.html</a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=1204</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>thinkphp地区管理功能</title>
		<link>https://www.yunda51.com/?p=1136</link>
		<comments>https://www.yunda51.com/?p=1136#comments</comments>
		<pubDate>Mon, 06 Jan 2014 03:49:03 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[php技术]]></category>
		<category><![CDATA[Thinkphp]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=1136</guid>
		<description><![CDATA[thinkphp地区管理功能的实现，实现效果图： 数据库结构： CREATE TABLE `sp_region<a href="https://www.yunda51.com/?p=1136" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>thinkphp地区管理功能的实现，实现效果图：<a href="http://www.yunda51.com/wp-content/uploads/2014/01/52c5030733619.jpg"><img src="http://www.yunda51.com/wp-content/uploads/2014/01/52c5030733619.jpg" alt="" title="52c5030733619" width="1181" height="312" class="alignnone size-full wp-image-1137" /></a><br />
<strong>数据库结构：</strong></p>
<pre class="wp-code-highlight prettyprint">
    CREATE TABLE `sp_region` (
      `Id` INT(11) NOT NULL AUTO_INCREMENT,
      `parent_id` INT(11) DEFAULT NULL,
      `region_name` VARCHAR(120) CHARACTER SET gbk DEFAULT NULL,
      `region_type` SMALLINT(5) DEFAULT NULL,
      `agency_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT &#039;0&#039;,
      `is_show` SMALLINT(5) NOT NULL DEFAULT &#039;0&#039;,
      PRIMARY KEY (`Id`)
    ) ENGINE=MYISAM AUTO_INCREMENT=3417 DEFAULT CHARSET=utf8 COLLATE=utf8_bin
</pre>
<p><strong>前台代码：</strong></p>
<pre class="wp-code-highlight prettyprint">
     &lt;form name=&quot;form1&quot; method=&quot;post&quot; id=&quot;myfrom&quot; action=&quot;__URL__/add&quot;&gt;
        &lt;table class=&quot;table_form&quot; style=&quot;border:0;&quot;&gt;
            &lt;tr&gt;
                &lt;th align=&quot;left&quot;&gt;
                {if $region_type=3}{$regionts}：
                    &lt;input type=&quot;text&quot; class=&quot;text-input&quot; name=&quot;region_name&quot; &gt;
                    &lt;input type=&quot;hidden&quot; name=&quot;region_type&quot; value=&quot;{$region_type}&quot; /&gt;
                    &lt;input type=&quot;hidden&quot; name=&quot;parent_id&quot; value=&quot;{$Id}&quot; /&gt;
                    &lt;input type=&quot;submit&quot; class=&quot;buttonAdd&quot; value=&quot;提交操作&quot;/&gt;
                {/if}
                    &lt;a href=&quot;{:U(&#039;Association/region&#039;,array(&quot;regiontype&quot;=&gt;$region_typeyuanshi,&#039;parentid&#039;=&gt;$fuID))}&quot;&gt;返回上一级&lt;/a&gt;
                &lt;/th&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/form&gt;
    &lt;div class=&quot;fl&quot; style=&quot;border:1px solid #66CCFF;&quot;&gt;
        &lt;table width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; &gt;
            &lt;tr&gt;&lt;td height=&quot;15&quot; style=&quot;background:#66CCFF; margin-top:0px; &quot;&gt;{$region_type}&lt;/td&gt;&lt;/tr&gt;
            &lt;tr bgcolor=&quot;#FFFFFF&quot;&gt;
                &lt;td&gt;
                    &lt;present name=&quot;list&quot;&gt;
                    &lt;volist name=&quot;list&quot; id=&quot;vo&quot;&gt;
                        &lt;div class=&#039;regionys&#039;&gt;&lt;span id=&quot;regionname{$vo[&#039;Id&#039;]}&quot;&gt;{$vo[&#039;region_name&#039;]}&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;
                        {if $region_type=3}
                            &lt;a href=&quot;{:U(&#039;Association/region&#039;,array(&quot;regiontype&quot;=&gt;$region_type,&#039;parentid&#039;=&gt;$vo[&#039;Id&#039;]))}&quot;&gt;管理&lt;/a&gt;
                        {/if}
                        &lt;a href=&quot;{:U(&#039;Association/delRegion&#039;,array(&quot;regionid&quot;=&gt;$vo[&#039;Id&#039;],&#039;parentid&#039;=&gt;$vo[&#039;Id&#039;]))}&quot; &gt;删除&lt;/a&gt;&lt;/div&gt;
                    &lt;/volist&gt;
                    &lt;else /&gt;
                        &lt;div class=&#039;regionys&#039;&gt;暂无地区&lt;/div&gt;
                    &lt;/present&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;&lt;td height=&quot;5&quot; style=&quot;background:#fff; margin-top:0px; &quot;&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;/table&gt;
    &lt;/div&gt;
    &lt;p class=&quot;i&quot;&gt;
        &lt;font color=&quot;red&quot;&gt;注视：&lt;/font&gt;1级地区：国家 2级地区：省份 3级地区：市级 4级地区：县/区
    &lt;/p&gt;
</pre>
<pre class="wp-code-highlight prettyprint">
  public function region(){
        $parent_id = intval(trim($_GET[&#039;parentid&#039;]));//父ID
        $region = D(&quot;region&quot;);
        $regionarr = $region-&gt;where(&quot; parent_id=&quot;.$parent_id)-&gt;select();
        if( $_GET[&#039;regiontype&#039;]==&quot;&quot;  ){
            $region_type = &#039;0&#039;;
            $regionts = &quot;新增1级地区&quot;;
        }else{
            if($regionarr[0][&#039;Id&#039;] == &quot;&quot;){
                //取出上一级的region_type
                $regiontypearr = $region-&gt;where(&#039;id=&#039;.$parent_id)-&gt;field(&#039;region_type&#039;)-&gt;find();
                $region_type = $regiontypearr[&#039;region_type&#039;]+1;
            }else{
                $region_type = $regionarr[0][&#039;region_type&#039;];
            }
            $regionts = $region_type+1;
            $regionts = &quot;新增&quot;.$regionts.&quot;级地区&quot;;
        }
        $this-&gt;assign(&quot;region_type&quot;,$region_type);//属于省份还是市
        $region_typeyuanshi=$region_type-1;
        $this-&gt;assign(&quot;region_typeyuanshi&quot;,$region_typeyuanshi);
        $this-&gt;assign(&quot;regionts&quot;,$regionts);//文字提示
        if(  $regionarr[0][&#039;parent_id&#039;] != 0){
            $fuidarr = $region-&gt;where(&quot;id=&quot;.$regionarr[0][&#039;parent_id&#039;])-&gt;find();//用fuID去取fuID的parent_id;
            $this-&gt;assign(&quot;fuID&quot;,  $fuidarr[&#039;parent_id&#039;]  );//返回上一级的时候，取的fuID
        }
        if( $region_type == 0 ){
            $this-&gt;assign(&#039;Id&#039;,  &#039;0&#039; );
        }else{
            $this-&gt;assign(&#039;Id&#039;, $parent_id );
        }
        $this-&gt;assign(&#039;list&#039;,$regionarr);
        $this-&gt;display();
    }
    function delRegion(){
        $region = D(&quot;Region&quot;);
        //删除
        if( $_GET[&#039;regionid&#039;] != &quot;&quot; ){
            //先判断是否有子分类
            $regionid= intval( $_GET[&#039;regionid&#039;] );
            $ziarr = $region-&gt;where(&quot;parent_id=&quot;.$regionid)-&gt;select();
            if( $ziarr[0][&#039;Id&#039;] != &quot;&quot; ){
                $this-&gt;error(&quot;请先删除子分类！&quot;);
            }else{
                $region-&gt;Id=$regionid;
                if($region-&gt;delete()){
                    $this-&gt;success();
                }else{
                    $this-&gt;error(&quot;删除失败&quot;);
                }
            }
        }
    }
    public function add(){
        $Region = D(&#039;Region&#039;);
        $region_name=trim($_POST[&#039;region_name&#039;]);
        if(!$region_name) $this-&gt;error(&quot;新增地区不能为空！&quot;);
        $Region-&gt;region_name = $region_name;
        $Region-&gt;region_type = trim($_POST[&#039;region_type&#039;]);
        $Region-&gt;parent_id   = trim($_POST[&#039;parent_id&#039;]);
        if($Region-&gt;add()){
            $this-&gt;success(&#039;添加成功！&#039;);
        }else{
            $this-&gt;error($Region-&gt;getError());
        }
    }
</pre>
<p>转载请注明转自:<a href="http://www.yunda51.com">运达's blog</a>  原文地址：<a href="http://www.yunda51.com/1136.html">http://www.yunda51.com/1136.html</a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=1136</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>解决Thinkphp内存不足的方法</title>
		<link>https://www.yunda51.com/?p=849</link>
		<comments>https://www.yunda51.com/?p=849#comments</comments>
		<pubDate>Tue, 12 Mar 2013 02:47:22 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[php技术]]></category>
		<category><![CDATA[Thinkphp]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=849</guid>
		<description><![CDATA[解决Thinkphp允许内存大小8388608字节用尽怎么解决呢，其实很简单，只要在.htaccess中添加如<a href="https://www.yunda51.com/?p=849" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>解决Thinkphp允许内存大小8388608字节用尽怎么解决呢，其实很简单，只要在.htaccess中添加如下代码就可以了：</p>
<div class="buy shortcodestyle">
php_value max_execution_time 1200<br />
php_value memory_limit 200M<br />
php_value post_max_size 200M<br />
php_value upload_max_filesize 200M
</div>
<p>这样就ok了！<br />
&nbsp;<br />
转载请注明转自:<a href="http://www.yunda51.com">运达's blog</a>  原文地址：<a href="http://www.yunda51.com/849.html">http://www.yunda51.com/849.html</a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=849</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>thinkphp3.0入口文件的写法</title>
		<link>https://www.yunda51.com/?p=839</link>
		<comments>https://www.yunda51.com/?p=839#comments</comments>
		<pubDate>Fri, 08 Mar 2013 10:07:42 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[Thinkphp]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=839</guid>
		<description><![CDATA[thinkphp3.0入口文件的写法跟thinkphp2.0的写法有所不同。今天用thinkphp3.0版本的<a href="https://www.yunda51.com/?p=839" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>thinkphp3.0入口文件的写法跟thinkphp2.0的写法有所不同。今天用thinkphp3.0版本的时候就出现了问题。以前thinkphp2.0的入口文件如下：</p>
<div class="buy shortcodestyle">&lt;?php<br />
//定义 ThinkPHP 框架路径<br />
define( 'THINK_PATH' , './ThinkPHP/' );<br />
//定义项目名称和路径<br />
define( 'APP_NAME' , 'home' );<br />
define( 'APP_PATH' , './home' );<br />
//加载框架入口文件<br />
require(THINK_PATH."/ThinkPHP.php");<br />
?&gt;</div>
<p>现在thinkphp3.0入口文件如下：</p>
<div class="buy shortcodestyle">&lt;?php<br />
//定义 ThinkPHP 框架路径<br />
require(THINK_PATH."/ThinkPHP.php");<br />
?&gt;</div>
<p>转载请注明转自:<a href="http://www.yunda51.com">运达's blog</a>  原文地址：<a href="http://www.yunda51.com/839.html">http://www.yunda51.com/839.html</a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=839</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Thinkphp里关于U函数生成URL伪静态</title>
		<link>https://www.yunda51.com/?p=688</link>
		<comments>https://www.yunda51.com/?p=688#comments</comments>
		<pubDate>Fri, 04 Jan 2013 09:52:16 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[Thinkphp]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=688</guid>
		<description><![CDATA[在 Thinkphp支持伪静态URL设置，可以通过设置URL_HTML_SUFFIX参数随意在URL的最后增加<a href="https://www.yunda51.com/?p=688" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>在 Thinkphp支持伪静态URL设置，可以通过设置URL_HTML_SUFFIX参数随意在URL的最后增加你想要的静态后缀，而不会影响当前操作的正常执行。例如，我们设置</p>
<ul type="1">
<li>'URL_HTML_SUFFIX'=&gt;'shtml'的话，我们可以把下面的URL</li>
<li>http://serverName/Tp/revise/id/1 变成 http://serverName/Tp/revise/id/1.shtml</li>
</ul>
<p>后者更具有静态页面的URL特征，但是具有和前面的URL相同的执行效果，并且不会影响原来参数的使用。 注意：伪静态后缀设置时可以不包含后缀中的“.”。所以，下面的配置其实是等效的：</p>
<ul type="1">
<li>'URL_HTML_SUFFIX'=&gt;'.shtml'伪静态设置后，如果需要动态生成一致的URL，可以使用U方法在模板文件里面生成URL。</li>
</ul>
<p><strong>关于多伪静态后缀的支持同时有效，可以使用下面的方式进行配置：</strong></p>
<p>'URL_HTML_SUFFIX'=&gt;'(shtml|html|xml)'</p>
<p>这样网站就能够支持多个伪静态后缀设置：</p>
<ul type="1">
<li>http://serverName/Tp/revise/1.shtml</li>
<li>http://serverName/Tp/revise/1.html</li>
<li>http://serverName/Tp/revise/1.xml</li>
</ul>
<p>配置多个伪静态后缀并不会导致自动判断后缀执行不同的方法。     例 如：&lt;a href=“{:U("News/revise/id/$vo[id]")}”&gt;标题&lt;/a&gt;</p>
<p>生成</p>
<p>&lt;a href="Tp/News/revise/id/1.html"&gt;标题&lt;/a&gt;，这样就完事了，但是大家一定要看清单引号和双引号，否则会让人很惆怅！</p>
<p>转载请注明转自:<a href="http://www.yunda51.com/">运达's blog</a>（原文地址：<a href="http://www.yunda51.com/?p=688">http://www.yunda51.com/?p=688</a>）</p>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=688</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Thinkphp里URL重写</title>
		<link>https://www.yunda51.com/?p=551</link>
		<comments>https://www.yunda51.com/?p=551#comments</comments>
		<pubDate>Mon, 24 Dec 2012 02:18:34 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[Thinkphp]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=551</guid>
		<description><![CDATA[话说伪静态是网站最常用的，通常的URL里面含有index.php,为了达到更好的SEO效果可能需要去掉URL里<a href="https://www.yunda51.com/?p=551" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>话说伪静态是网站最常用的，通常的URL里面含有index.php,为了达到更好的SEO效果可能需要去掉URL里面的index.php ,通过URL重写的方式可以达到这种效果，通常需要服务器开启URL_REWRITE模块才能支持。</p>
<p>下面是Apache的配置过程，可以参考下：</p>
<p>1、httpd.conf配置文件中加载了mod_rewrite.so模块</p>
<p>2、AllowOverride None 将None改为 All</p>
<p>3、确保'URL_MODEL' =&gt;  2, // 如果你的环境不支持PATHINFO 请设置为3</p>
<p>4、创建.htaccess文件，并且把.htaccess文件放到入口文件的同级目录下</p>
<p>&lt;IfModule mod_rewrite.c&gt;</p>
<p>RewriteEngine on</p>
<p>RewriteCond %{REQUEST_FILENAME} !-d</p>
<p>RewriteCond %{REQUEST_FILENAME} !-f</p>
<p>RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</p>
<p>&lt;/IfModule&gt;</p>
<p>这样就Ok了！</p>
<p>转载请注明转自:<a href="http://www.yunda51.com/">运达's blog</a>（原文地址：<a href="http://www.yunda51.com/?p=551">http://www.yunda51.com/?p=551</a>）</p>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=551</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>thinkphp访问安全问题</title>
		<link>https://www.yunda51.com/?p=452</link>
		<comments>https://www.yunda51.com/?p=452#comments</comments>
		<pubDate>Sun, 09 Dec 2012 14:51:42 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[Thinkphp]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=452</guid>
		<description><![CDATA[用了一段时间ThinkPHP框架后，感觉这是一个挺不错的PHP框架，用着舒服，但了解深入一点之后，感觉在安全性<a href="https://www.yunda51.com/?p=452" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>用了一段时间ThinkPHP框架后，感觉这是一个挺不错的PHP框架，用着舒服，但了解深入一点之后，感觉在安全性</p>
<p>方面还有一点事情要做做。对于ThinkPHP框架，他有固定的文件目录和一些固定的文件名称，所以，对于一个应用，</p>
<p>有很多文件名称和目录是可以猜测出来的，这样我们就可以通过该文件的URL直接访问，绕过了ThinkPHP框架的访</p>
<p>问模式，特别是在Tpl目录和Lib目录，这两个地方都是关键地方，如何才能阻止直接对这几个目录进行访问呢？我用</p>
<p>到的方法是Apache服务器的Rewrite。</p>
<p>首先，在http.conf配置文件中启用和配置好Rewrite模块。在该文件中增加如下配置信息：</p>
<p>（1）LoadModule rewrite_module Modules/mod_rewrite.so</p>
<p>（2）注意&lt;Directory /&gt;配置字段中的AllowOverride和Options，我配置的如下：<br />
&lt;Directory /&gt;<br />
AllowOverride FileInfo<br />
Options FollowSymLinks<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;</p>
<p>然后，在Lib目录新建一个.htaccess的文件，内容如下：<br />
RewriteEngine on<br />
RewriteRule ^(.*)$ /index.php<br />
将对该目录的所有访问转到项目的启动文件上，从而屏蔽掉对该目录的访问。</p>
<p>对于Tpl目录设置有点不同，因为该目录还存放其他文件，比如图片文件(*.jpg)等，而我们要阻止的仅仅是</p>
<p>html文件的访问，所有在default目录下新建的.htaccess文件中的内容如下：<br />
RewriteEngine on<br />
RewriteRule ^(.*\.html)$ \index.php [NC]<br />
将对该目录下所有html文件的访问转到项目的启动文件上，对于其他文件不变。</p>
<p>上面只是我的一些测试方法，对于这两个目录的安全性是不是真有问题，也还得进一步验证，权且当作是对</p>
<p>Rewrite的一次练习吧。</p>
<p>转载请注明转自:<a href="http://www.yunda51.com/">运达's blog</a>（原文地址：<a title="原文链接" href="http://www.yunda51.com/?p=452">http://www.yunda51.com/?p=452</a>）</p>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=452</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
