﻿<?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>学习日记 &#187; Php</title>
	<atom:link href="https://www.softwareace.cn/?cat=18&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://www.softwareace.cn</link>
	<description>时刻想着为自己的产品多做一些对他好的事情</description>
	<lastBuildDate>Fri, 20 Mar 2026 06:58:28 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>Linux CentOS完全卸载PHP</title>
		<link>https://www.softwareace.cn/?p=1789</link>
		<comments>https://www.softwareace.cn/?p=1789#comments</comments>
		<pubDate>Wed, 30 May 2018 13:51:11 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1789</guid>
		<description><![CDATA[很无语，CentOS居然php版本才5.1.6，很多开源的CMS无法安装。 查看php版本命令： #php - [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>很无语，CentOS居然php版本才5.1.6，很多开源的CMS无法安装。</p>
<p>查看php版本命令：</p>
<blockquote>
<p style="color: #777777;">#php -v</p>
</blockquote>
<p>下面的命令是删除不干净的</p>
<blockquote>
<p style="color: #777777;">#yum remove php</p>
</blockquote>
<p>因为使用这个命令以后再用</p>
<blockquote>
<p style="color: #777777;">#php -v</p>
</blockquote>
<p>还是会看到有版本信息的。。。。。</p>
<p>&nbsp;</p>
<p>必须强制删除，使用下面命令查看全部php软件包</p>
<blockquote>
<p style="color: #777777;">#rpm -qa|grep php</p>
</blockquote>
<p>提示如下：</p>
<blockquote>
<p style="color: #777777;">#php-pdo-5.1.6-27.el5_5.3<br />
#php-mysql-5.1.6-27.el5_5.3<br />
#php-xml-5.1.6-27.el5_5.3<br />
#php-cli-5.1.6-27.el5_5.3<br />
#php-common-5.1.6-27.el5_5.3<br />
#php-gd-5.1.6-27.el5_5.3</p>
</blockquote>
<p><span style="color: #ff9900;">注意卸载要先卸载没有依赖的</span></p>
<p>pdo是mysql的依赖项；common是gd的依赖项；<br />
例如：# rpm -e php-pdo-5.1.6-27.el5_5.3<br />
error: Failed dependencies:<br />
php-pdo is needed by (installed) php-mysql-5.1.6-27.el5_5.3.i386</p>
<p>所以正确的卸载顺序是：</p>
<blockquote>
<p style="color: #777777;"># rpm -e php-mysql-5.1.6-27.el5_5.3<br />
# rpm -e php-pdo-5.1.6-27.el5_5.3<br />
# rpm -e php-xml-5.1.6-27.el5_5.3<br />
# rpm -e php-cli-5.1.6-27.el5_5.3<br />
# rpm -e php-gd-5.1.6-27.el5_5.3<br />
# rpm -e php-common-5.1.6-27.el5_5.3</p>
</blockquote>
<p>再用</p>
<blockquote>
<p style="color: #777777;"># php -v</p>
</blockquote>
<p>查看版本信息已经没有提示</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1789</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS yum 安装 PHP 5.6.24</title>
		<link>https://www.softwareace.cn/?p=1785</link>
		<comments>https://www.softwareace.cn/?p=1785#comments</comments>
		<pubDate>Wed, 30 May 2018 13:47:16 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1785</guid>
		<description><![CDATA[如果之前有安装其他版本PHP，请先卸载干净 配置yum源 追加CentOS 6.5的epel及remi源。 # [&#8230;]]]></description>
				<content:encoded><![CDATA[<div>如果之前有安装其他版本PHP，请先卸载干净</div>
<div></div>
<div>
<div>配置yum源</div>
<div>追加CentOS 6.5的epel及remi源。</div>
<div>
<div># rpm -Uvh <a style="color: #6795b5;" href="http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm" target="_blank">http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm</a></div>
<div># rpm -Uvh <a style="color: #6795b5;" href="http://rpms.famillecollet.com/enterprise/remi-release-6.rpm" target="_blank">http://rpms.famillecollet.com/enterprise/remi-release-6.rpm</a></div>
</div>
<div>以下是CentOS 7.0的源。</div>
<div>
<div># yum install epel-release</div>
<div># rpm -ivh <a style="color: #6795b5;" href="http://rpms.famillecollet.com/enterprise/remi-release-7.rpm" target="_blank">http://rpms.famillecollet.com/enterprise/remi-release-7.rpm</a></div>
</div>
<div>使用yum list命令查看可安装的包(Packege)。</div>
<div># yum list &#8211;enablerepo=remi &#8211;enablerepo=remi-php56 | grep php</div>
<div>安装PHP5.6</div>
<div>yum源配置好了，下一步就安装PHP5.6。</div>
<div># yum install &#8211;enablerepo=remi &#8211;enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof</div>
<div>用PHP命令查看版本。</div>
<div>
<div># php &#8211;version</div>
<div>PHP 5.6.0 (cli) (built: Sep 3 2014 19:51:31)</div>
<div>Copyright (c) 1997-2014 The PHP Group</div>
<div>Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies</div>
<div>with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies</div>
<div>with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans</div>
<div></div>
<div></div>
<div>
<div>这边给你提供安装php5.6的yum方法扩展自选。</div>
<div># rpm -Uvh <a style="color: #6795b5;" href="http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm" target="_blank">http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm</a></div>
<div># rpm -Uvh <a style="color: #6795b5;" href="http://rpms.famillecollet.com/enterprise/remi-release-6.rpm" target="_blank">http://rpms.famillecollet.com/enterprise/remi-release-6.rpm</a></div>
</div>
<div>
<div><span style="color: #c7254e;"># yum install &#8211;enablerepo=remi &#8211;enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof</span>空格跟上自己想要的扩展</div>
<div># yum &#8211;enablerepo=remi-php56 install php-gd php-mysql php-mbstring php-xml php-mcrypt忘记的扩展在运行一次就ok了<span style="color: #ff0000;">（常用的GD库安装）</span></div>
<div></div>
<div>重启服务</div>
<div>sudo service apache2 restart</div>
<div></div>
<div>httpd 错误日志目录</div>
<div>/var/log/httpd/error_log</div>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1785</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决NGINX PHP ＂No input file specified＂</title>
		<link>https://www.softwareace.cn/?p=1695</link>
		<comments>https://www.softwareace.cn/?p=1695#comments</comments>
		<pubDate>Wed, 27 Sep 2017 02:41:25 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1695</guid>
		<description><![CDATA[[crayon-69df335e859d7817961733/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">1. 更改php.ini
首先php.ini的配置中把
;cgi.fix_pathinfo=0   改为
cgi.fix_pathinfo=1


2. 在nginx/conf/nginx.conf   找到： 
fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;  改为： 
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1695</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决Web部署 svg/woff/woff2字体 404错误</title>
		<link>https://www.softwareace.cn/?p=1537</link>
		<comments>https://www.softwareace.cn/?p=1537#comments</comments>
		<pubDate>Mon, 14 Nov 2016 04:38:16 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1537</guid>
		<description><![CDATA[问题：最近在IIS上部署web项目的时候，发现浏览器总是报找不到woff、woff2字体的错误。导致浏览器加载 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>问题：</strong>最近在IIS上部署web项目的时候，发现浏览器总是报找不到woff、woff2字体的错误。导致浏览器加载字体报404错误，白白消耗了100-200毫秒的加载时间。</p>
<p><strong>原因：</strong>因为服务器IIS不认SVG，WOFF/WOFF2 这几个文件类型，只要在IIS上添加MIME 类型即可。</p>
<p><strong><span style="color: #444444;">解决方法</span></strong></p>
<p>1、打开服务器IIS管理器，找到MIME类型。</p>
<p><img src="http://images.cnitblog.com/blog/144798/201501/091003532819095.png" alt="" width="476" height="273" /></p>
<p>2、添加MIME类型 添加三条：</p>
<p><strong>文件扩展名</strong>      <strong>MIME类型</strong></p>
<p>.svg             image/svg+xml<br />
.woff            application/x-font-woff<br />
.woff2          application/x-font-woff</p>
<p><span style="color: #0000ff;"><em>注：本文在win8环境下IIS7版本中填写的MIME类型，在IIS6、IIS7 MIME类型管理所处位置不一样，但是添加方式和参数均相同。</em></span></p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1537</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP+Mysql+jQuery找回密码</title>
		<link>https://www.softwareace.cn/?p=1165</link>
		<comments>https://www.softwareace.cn/?p=1165#comments</comments>
		<pubDate>Fri, 30 Jan 2015 10:17:11 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1165</guid>
		<description><![CDATA[通常所说的密码找回功能不是真的能把忘记的密码找回，因为我们的密码是加密保存的，一般开发者会在验证用户信息后通过 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="color: #424242;">通常所说的密码找回功能不是真的能把忘记的密码找回，因为我们的密码是加密保存的，一般开发者会在验证用户信息后通过程序生成一个新密码或者生成一个特定的链接并发送邮件到用户邮箱，用户从邮箱链接到网站的重置密码模块重新设置新密码。</p>
<div class="art_img" style="color: #424242;"><img src="http://www.helloweba.com/attachments/fck/resetpass.gif" alt="" /></div>
<div class="blog_opt" style="color: #424242;"><a class="button blue" style="color: #d9eef7;" href="http://www.helloweba.com/demo/resetpass/" target="_blank">查看演示</a> <a class="button green" style="color: #e8f0de;" href="http://www.helloweba.com/down-229.html" target="_blank">下载源码</a></div>
<div id="art_content" style="color: #424242;">
<p>当然现在有的网站也有手机短信的方式找回密码，原理就是通过发送验证码来验明正身，和发送邮件验证一样，最终还是要通过重置密码来完成找回密码的流程。</p>
<p>本文将使用PHP+Mysql+jQuery来实现一个密码找回的功能，一般步骤是：</p>
<p>1.表单输入注册时的邮箱；</p>
<p>2.验证用户邮箱是否正确，如果用户邮箱不存在网站的用户表中，则提示用户邮箱未注册；</p>
<p>3.发送邮件，如果用户邮箱确实存在用户表中，则组合用于验证用户信息的字符串，并构造URL发送到用户邮箱中;</p>
<p>4.用户登录邮箱收取邮件，点击URL链接到网站验证程序；</p>
<p>5.网站程序通过用户请求的字符串查询本地用户表，比对用户信息是否正确；</p>
<p>6.如果正确则转到重置密码页面重新设置新密码，反之则提示用户验证无效。</p>
<h4>HTML</h4>
<p>我们在找回密码的页面上放置一个要求用户输入注册时所用的邮箱，然后提交前台js来处理交互。</p><pre class="crayon-plain-tag">&nbsp;
&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;p&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;strong&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;输入您注册的电子邮箱，找回密码：&lt;span class=&quot;html__tag_end&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_end&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&nbsp;
&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;p&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;input&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;text&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;input&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;email&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;email&quot;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;span&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;chkmsg&quot;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_end&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_end&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&nbsp;
&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;p&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;input&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;button&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;btn&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;sub_btn&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;value&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;提&nbsp;交&quot;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_end&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&nbsp;</pre><p></p>
<h4>jQuery</h4>
<p>当用户输入完邮箱并点击提交后，jQuery先验证邮箱格式是否正确，如果正确则通过向后台sendmail.php发送Ajax请求，sendmail.php负责验证邮箱是否存在和发送邮件，并会返回相应的处理结果给前台页面，请看jQuery代码：</p><pre class="crayon-plain-tag">&nbsp;
$(&lt;span class=&quot;js__operator&quot; style=&quot;font-weight: bold; color: #4169e1;&quot;&gt;function&lt;/span&gt;()&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;{&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;$(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;#sub_btn&quot;&lt;/span&gt;).click(&lt;span class=&quot;js__operator&quot; style=&quot;font-weight: bold; color: #4169e1;&quot;&gt;function&lt;/span&gt;()&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;{&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;js__statement&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;var&lt;/span&gt;&nbsp;email&nbsp;=&nbsp;$(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;#email&quot;&lt;/span&gt;).val();&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;js__statement&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;var&lt;/span&gt;&nbsp;preg&nbsp;=&nbsp;&lt;span class=&quot;js__reg_exp&quot; style=&quot;color: maroon;&quot;&gt;/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/&lt;/span&gt;;&nbsp;&lt;span class=&quot;js__sl_comment&quot; style=&quot;color: green;&quot;&gt;//匹配Email&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;js__statement&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(email==&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;''&lt;/span&gt;&nbsp;||&nbsp;!preg.test(email))&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;{&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;#chkmsg&quot;&lt;/span&gt;).html(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;请填写正确的邮箱！&quot;&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;js__statement&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;{&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;#sub_btn&quot;&lt;/span&gt;).attr(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;disabled&quot;&lt;/span&gt;,&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;disabled&quot;&lt;/span&gt;).val(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;'提交中..'&lt;/span&gt;).css(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;cursor&quot;&lt;/span&gt;,&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;default&quot;&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$.post(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;sendmail.php&quot;&lt;/span&gt;,&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;{&lt;/span&gt;mail:email&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;}&lt;/span&gt;,&lt;span class=&quot;js__operator&quot; style=&quot;font-weight: bold; color: #4169e1;&quot;&gt;function&lt;/span&gt;(msg)&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;{&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;js__statement&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(msg==&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;noreg&quot;&lt;/span&gt;)&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;{&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;#chkmsg&quot;&lt;/span&gt;).html(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;该邮箱尚未注册！&quot;&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;#sub_btn&quot;&lt;/span&gt;).removeAttr(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;disabled&quot;&lt;/span&gt;).val(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;'提&nbsp;交'&lt;/span&gt;).css(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;cursor&quot;&lt;/span&gt;,&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;pointer&quot;&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;js__statement&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;{&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;.demo&quot;&lt;/span&gt;).html(&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;&amp;lt;h3&amp;gt;&quot;&lt;/span&gt;+msg+&lt;span class=&quot;js__string&quot; style=&quot;color: teal;&quot;&gt;&quot;&amp;lt;/h3&amp;gt;&quot;&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;}&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;}&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;}&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;}&lt;/span&gt;);&nbsp;
&lt;span class=&quot;js__brace&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;}&lt;/span&gt;)&nbsp;</pre><p>以上使用的jQuery代码很方便简洁的完成了前端交互操作，如果您有一定的jQuery基础，那上面的代码一目了然，不多解释。</p>
<p>当然别忘了在页面中加载jQuery库文件，有的同学经常问我说从helloweba.com下载了demo怎么用不了，那80%是jquery或者其他文件加载路径错了导致没加载必要的文件。</p>
<h4>PHP</h4>
<p>sendmail.php需要验证Email是否存在系统用户表中，如果有，则读取用户信息，将用户id、用户名和密码惊醒md5加密生成一个特别的字符串作为找回密码的验证码，然后构造URL。同时我们为了控制URL链接的时效性，将记录用户提交找回密码动作的操作时间，最后调用邮件发送类发送邮件到用户邮箱，发送邮件类smtp.class.php已经打包好，请下载。</p><pre class="crayon-plain-tag">&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;include_once&lt;/span&gt;(&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;connect.php&quot;&lt;/span&gt;);&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//连接数据库&lt;/span&gt;&nbsp;
&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;email&lt;/span&gt;&nbsp;=&nbsp;stripslashes(trim(&lt;span class=&quot;php__global&quot; style=&quot;color: red;&quot;&gt;$_POST&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'mail'&lt;/span&gt;]));&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;sql&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;select&nbsp;id,username,password&nbsp;from&nbsp;`t_user`&nbsp;where&nbsp;`email`='$email'&quot;&lt;/span&gt;;&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;query&lt;/span&gt;&nbsp;=&nbsp;mysql_query(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;sql&lt;/span&gt;);&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;num&lt;/span&gt;&nbsp;=&nbsp;mysql_num_rows(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;query&lt;/span&gt;);&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;num&lt;/span&gt;==&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;0&lt;/span&gt;){&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//该邮箱尚未注册！&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;echo&lt;/span&gt;&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'noreg'&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;exit&lt;/span&gt;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;else&lt;/span&gt;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;&nbsp;=&nbsp;mysql_fetch_array(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;query&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;getpasstime&lt;/span&gt;&nbsp;=&nbsp;time();&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;uid&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'id'&lt;/span&gt;];&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;token&lt;/span&gt;&nbsp;=&nbsp;md5(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;uid&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'username'&lt;/span&gt;].&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'password'&lt;/span&gt;]);&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//组合验证码&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;url&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;http://www.helloweba.com/demo/resetpass/reset.php?email=&quot;&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;email&lt;/span&gt;.&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&nbsp;
&amp;amp;token=&quot;&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;token&lt;/span&gt;;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//构造URL&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;time&lt;/span&gt;&nbsp;=&nbsp;date(&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'Y-m-d&nbsp;H:i'&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;result&lt;/span&gt;&nbsp;=&nbsp;sendmail(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;time&lt;/span&gt;,&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;email&lt;/span&gt;,&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;url&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;result&lt;/span&gt;==&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;1&lt;/span&gt;){&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//邮件发送成功&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'系统已向您的邮箱发送了一封邮件&amp;lt;br/&amp;gt;请登录到您的邮箱及时重置您的密码！'&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//更新数据发送时间&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mysql_query(&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;update&nbsp;`t_user`&nbsp;set&nbsp;`getpasstime`='$getpasstime'&nbsp;where&nbsp;id='$uid&nbsp;'&quot;&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;else&lt;/span&gt;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;result&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;echo&lt;/span&gt;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;;&nbsp;
}&nbsp;
&nbsp;
&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//发送邮件&lt;/span&gt;&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;function&lt;/span&gt;&nbsp;sendmail(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;time&lt;/span&gt;,&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;email&lt;/span&gt;,&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;url&lt;/span&gt;){&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;include_once&lt;/span&gt;(&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;smtp.class.php&quot;&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpserver&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&quot;&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//SMTP服务器，如smtp.163.com&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpserverport&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;25&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//SMTP服务器端口&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpusermail&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&quot;&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//SMTP服务器的用户邮箱&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpuser&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&quot;&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//SMTP服务器的用户帐号&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtppass&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&quot;&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//SMTP服务器的用户密码&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtp&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;new&lt;/span&gt;&nbsp;Smtp(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpserver&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpserverport&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;true&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpuser&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtppass&lt;/span&gt;);&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//这里面的一个true是表示使用身份验证,否则不使用身份验证.&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailtype&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;HTML&quot;&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//信件类型，文本:text；网页：HTML&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpemailto&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;email&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpemailfrom&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpusermail&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailsubject&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;Helloweba.com&nbsp;-&nbsp;找回密码&quot;&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailbody&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;亲爱的&quot;&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;email&lt;/span&gt;.&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;：&amp;lt;br/&amp;gt;您在&quot;&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;time&lt;/span&gt;.&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;提交了找回密码请求。请点击下面的链接重置密码&nbsp;
（按钮24小时内有效）。&amp;lt;br/&amp;gt;&amp;lt;a&nbsp;href='&quot;&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;url&lt;/span&gt;.&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;'target='_blank'&amp;gt;&quot;&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;url&lt;/span&gt;.&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&amp;lt;/a&amp;gt;&quot;&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;rs&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtp&lt;/span&gt;-&amp;gt;sendmail(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpemailto&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpemailfrom&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailsubject&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailbody&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailtype&lt;/span&gt;);&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;return&lt;/span&gt;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;rs&lt;/span&gt;;&nbsp;
}&nbsp;</pre><p>好了，这个时候你的邮箱将会收到一封来自helloweba的密码找回邮件，邮件内容中有一个URL链接，点击该链接到helloweba.com的reset.php来验证邮箱。</p><pre class="crayon-plain-tag">&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;include_once&lt;/span&gt;(&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;connect.php&quot;&lt;/span&gt;);&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//连接数据库&lt;/span&gt;&nbsp;
&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;token&lt;/span&gt;&nbsp;=&nbsp;stripslashes(trim(&lt;span class=&quot;php__global&quot; style=&quot;color: red;&quot;&gt;$_GET&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'token'&lt;/span&gt;]));&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;email&lt;/span&gt;&nbsp;=&nbsp;stripslashes(trim(&lt;span class=&quot;php__global&quot; style=&quot;color: red;&quot;&gt;$_GET&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'email'&lt;/span&gt;]));&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;sql&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;select&nbsp;*&nbsp;from&nbsp;`t_user`&nbsp;where&nbsp;email='$email'&quot;&lt;/span&gt;;&nbsp;
&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;query&lt;/span&gt;&nbsp;=&nbsp;mysql_query(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;sql&lt;/span&gt;);&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;&nbsp;=&nbsp;mysql_fetch_array(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;query&lt;/span&gt;);&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;){&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;mt&lt;/span&gt;&nbsp;=&nbsp;md5(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'id'&lt;/span&gt;].&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'username'&lt;/span&gt;].&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'password'&lt;/span&gt;]);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;mt&lt;/span&gt;==&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;token&lt;/span&gt;){&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(time()-&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'getpasstime'&lt;/span&gt;]&amp;gt;&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;24&lt;/span&gt;*&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;60&lt;/span&gt;*&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;60&lt;/span&gt;){&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'该链接已过期！'&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;else&lt;/span&gt;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//重置密码...&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'请重新设置密码，显示重置密码表单，&amp;lt;br/&amp;gt;这里只是演示，略过。'&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;else&lt;/span&gt;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'无效的链接'&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
}&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;else&lt;/span&gt;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'错误的链接！'&lt;/span&gt;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;echo&lt;/span&gt;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;;&nbsp;</pre><p>reset.php首先接受参数email和token，然后根据email查询数据表t_user中是否存在该Email，如果存在则获取该用户的信息，并且和sendmail.php中的token组合方式一样构建token值，然后与url传过来的token进行对比，如果当前时间与发送邮件时的时间相差超过24小时的，则提示“该链接已过期！”，反之，则说明链接有效，并且调转到重置密码页面，最后就是用户自己设置新密码了。</p>
<p>小结：通过注册邮箱验证与本文邮件找回密码，我们知道发送邮件在网站开发中的应用以及它的重要性，当然，现在也流行短信验证应用，这个需要相关的短信接口对接就可以了。</p>
<p>最后，附上数据表t_user结构：</p><pre class="crayon-plain-tag">&nbsp;
CREATE&nbsp;TABLE&nbsp;`t_user`&nbsp;(&nbsp;
&nbsp;&nbsp;`id`&nbsp;int(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;11&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;&nbsp;auto_increment,&nbsp;
&nbsp;&nbsp;`username`&nbsp;varchar(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;30&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;`password`&nbsp;varchar(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;32&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;`email`&nbsp;varchar(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;50&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;`getpasstime`&nbsp;int(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;10&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;PRIMARY&nbsp;KEY&nbsp;&nbsp;(`id`)&nbsp;
)&nbsp;ENGINE=MyISAM&nbsp;&nbsp;DEFAULT&nbsp;CHARSET=utf8;

http://www.helloweba.com/view-blog-229.html&nbsp;</pre><p>
</p></div>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1165</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP用户注册邮箱验证激活帐号</title>
		<link>https://www.softwareace.cn/?p=1163</link>
		<comments>https://www.softwareace.cn/?p=1163#comments</comments>
		<pubDate>Fri, 30 Jan 2015 10:15:24 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1163</guid>
		<description><![CDATA[我们在很多网站注册会员时，注册完成后，系统会自动向用户的邮箱发送一封邮件，这封邮件的内容就是一个URL链接，用 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="color: #424242;">我们在很多网站注册会员时，注册完成后，系统会自动向用户的邮箱发送一封邮件，这封邮件的内容就是一个URL链接，用户需要点击打开这个链接才能激活之前在该网站注册的帐号。激活成功后才能正常使用会员功能。</p>
<div class="blog_opt" style="color: #424242;"><a class="button blue" style="color: #d9eef7;" href="http://www.helloweba.com/demo/register/" target="_blank">查看演示</a> <a class="button green" style="color: #e8f0de;" href="http://www.helloweba.com/down-228.html" target="_blank">下载源码</a></div>
<div id="art_content" style="color: #424242;">
<p>本文将结合实例，讲解如何使用PHP+Mysql完成注册帐号、发送激活邮件、验证激活帐号、处理URL链接过期的功能。</p>
<h4>业务流程</h4>
<p>1、用户提交注册信息。</p>
<p>2、写入数据库，此时帐号状态未激活。</p>
<p>3、将用户名密码或其他标识字符加密构造成激活识别码（你也可以叫激活码）。</p>
<p>4、将构造好的激活识别码组成URL发送到用户提交的邮箱。</p>
<p>5、用户登录邮箱并点击URL，进行激活。</p>
<p>6、验证激活识别码，如果正确则激活帐号。</p>
<h4>准备数据表</h4>
<p>用户信息表中字段Email很重要，它可以用来验证用户、找回密码、甚至对网站方来说可以用来收集用户信息进行Email营销，以下是用户信息表t_user的表结构：</p><pre class="crayon-plain-tag">&nbsp;
CREATE&nbsp;TABLE&nbsp;IF&nbsp;NOT&nbsp;EXISTS&nbsp;`t_user`&nbsp;(&nbsp;
&nbsp;&nbsp;`id`&nbsp;int(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;11&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;&nbsp;AUTO_INCREMENT,&nbsp;
&nbsp;&nbsp;`username`&nbsp;varchar(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;30&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;&nbsp;COMMENT&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'用户名'&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;`password`&nbsp;varchar(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;32&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;&nbsp;COMMENT&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'密码'&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;`email`&nbsp;varchar(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;30&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;&nbsp;COMMENT&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'邮箱'&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;`token`&nbsp;varchar(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;50&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;&nbsp;COMMENT&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'帐号激活码'&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;`token_exptime`&nbsp;int(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;10&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;&nbsp;COMMENT&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'激活码有效期'&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;`status`&nbsp;tinyint(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;1&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;&nbsp;DEFAULT&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'0'&lt;/span&gt;&nbsp;COMMENT&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'状态,0-未激活,1-已激活'&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;`regtime`&nbsp;int(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;10&lt;/span&gt;)&nbsp;NOT&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;NULL&lt;/span&gt;&nbsp;COMMENT&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'注册时间'&lt;/span&gt;,&nbsp;
&nbsp;&nbsp;PRIMARY&nbsp;KEY&nbsp;(`id`)&nbsp;
)&nbsp;ENGINE=MyISAM&nbsp;&nbsp;DEFAULT&nbsp;CHARSET=utf8;&nbsp;</pre><p></p>
<h4>HTML</h4>
<p>在页面中放置一个注册表单，用户可以输入注册信息，包括用户名、密码和邮箱。</p><pre class="crayon-plain-tag">&nbsp;
&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;form&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;reg&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;action&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;register.php&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;method&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;post&quot;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;p&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;用户名：&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;input&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;text&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;input&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;username&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;user&quot;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_end&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;p&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;密&nbsp;码：&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;input&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;password&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;input&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;password&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;pass&quot;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_end&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;p&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;E-mail：&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;input&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;text&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;input&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;email&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;email&quot;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_end&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;p&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;lt;input&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;submit&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;btn&quot;&lt;/span&gt;&nbsp;&lt;span class=&quot;html__attr_name&quot; style=&quot;color: green;&quot;&gt;value&lt;/span&gt;=&lt;span class=&quot;html__attr_value&quot; style=&quot;color: maroon;&quot;&gt;&quot;提交注册&quot;&lt;/span&gt;&lt;span class=&quot;html__tag_start&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;html__tag_end&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&nbsp;
&lt;span class=&quot;html__tag_end&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;&nbsp;</pre><p>对于用户的输入要进行必要的前端验证，关于表单验证功能，建议您参考本站文章：<a style="color: #336699;" href="http://www.helloweba.com/view-blog-53.html" target="_blank">实例讲解表单验证插件Validation的应用</a>，本文对前端验证代码略过，另外其实页面中还应该有个要求用户重复输入密码的输入框，一时偷懒就此略过。</p>
<h4>register.php</h4>
<p>用户将注册信息提交到register.php进行处理。register.php需要完成写入数据和发送邮件两大功能。</p>
<p>首先包含必要的两个文件，connect.php和smtp.class.php，这两个文件在外面提供的下载包里有，欢迎下载。</p><pre class="crayon-plain-tag">&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;include_once&lt;/span&gt;(&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;connect.php&quot;&lt;/span&gt;);&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//连接数据库&lt;/span&gt;&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;include_once&lt;/span&gt;(&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;smtp.class.php&quot;&lt;/span&gt;);&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//邮件发送类&lt;/span&gt;&nbsp;</pre><p>然后我们要过滤用户提交的信息，并验证用户名是否存在（前端也可以验证）。</p><pre class="crayon-plain-tag">&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;username&lt;/span&gt;&nbsp;=&nbsp;stripslashes(trim(&lt;span class=&quot;php__global&quot; style=&quot;color: red;&quot;&gt;$_POST&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'username'&lt;/span&gt;]));&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;query&lt;/span&gt;&nbsp;=&nbsp;mysql_query(&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;select&nbsp;id&nbsp;from&nbsp;t_user&nbsp;where&nbsp;username='$username'&quot;&lt;/span&gt;);&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;num&lt;/span&gt;&nbsp;=&nbsp;mysql_num_rows(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;query&lt;/span&gt;);&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;num&lt;/span&gt;==&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;1&lt;/span&gt;){&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;echo&lt;/span&gt;&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'用户名已存在，请换个其他的用户名'&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;exit&lt;/span&gt;;&nbsp;
}&nbsp;</pre><p>接着我们将用户密码加密，构造激活识别码：</p><pre class="crayon-plain-tag">&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;password&lt;/span&gt;&nbsp;=&nbsp;md5(trim(&lt;span class=&quot;php__global&quot; style=&quot;color: red;&quot;&gt;$_POST&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'password'&lt;/span&gt;]));&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//加密密码&lt;/span&gt;&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;email&lt;/span&gt;&nbsp;=&nbsp;trim(&lt;span class=&quot;php__global&quot; style=&quot;color: red;&quot;&gt;$_POST&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'email'&lt;/span&gt;]);&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//邮箱&lt;/span&gt;&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;regtime&lt;/span&gt;&nbsp;=&nbsp;time();&nbsp;
&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;token&lt;/span&gt;&nbsp;=&nbsp;md5(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;username&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;password&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;regtime&lt;/span&gt;);&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//创建用于激活识别码&lt;/span&gt;&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;token_exptime&lt;/span&gt;&nbsp;=&nbsp;time()+&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;60&lt;/span&gt;*&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;60&lt;/span&gt;*&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;24&lt;/span&gt;;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//过期时间为24小时后&lt;/span&gt;&nbsp;
&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;sql&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;insert&nbsp;into&nbsp;`t_user`&nbsp;(`username`,`password`,`email`,`token`,`token_exptime`,`regtime`)&nbsp;&nbsp;
values&nbsp;('$username','$password','$email','$token','$token_exptime','$regtime')&quot;&lt;/span&gt;;&nbsp;
&nbsp;
mysql_query(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;sql&lt;/span&gt;);&nbsp;</pre><p>上述代码中，$token即构造好的激活识别码，它是由用户名、密码和当前时间组成并md5加密得来的。$token_exptime用于设置激活链接URL的过期时间，用户在这个时间段内可以激活帐号，本例设置的是24小时内激活有效。最后将这些字段插入到数据表t_user中。</p>
<p>当数据插入成功后，调用邮件发送类将激活信息发送给用户注册的邮箱，注意将构造好的激活识别码组成一个完整的URL作为用户点击时的激活链接，以下是详细代码：</p><pre class="crayon-plain-tag">&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(mysql_insert_id()){&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpserver&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&quot;&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//SMTP服务器，如：smtp.163.com&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpserverport&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;25&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//SMTP服务器端口，一般为25&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpusermail&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&quot;&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//SMTP服务器的用户邮箱，如xxx@163.com&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpuser&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&quot;&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//SMTP服务器的用户帐号xxx@163.com&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtppass&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&quot;&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//SMTP服务器的用户密码&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtp&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;new&lt;/span&gt;&nbsp;Smtp(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpserver&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpserverport&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__value&quot; style=&quot;font-weight: bold; color: gray;&quot;&gt;true&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpuser&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtppass&lt;/span&gt;);&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//实例化邮件类&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailtype&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;HTML&quot;&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//信件类型，文本:text；网页：HTML&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpemailto&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;email&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//接收邮件方，本例为注册用户的Email&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpemailfrom&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpusermail&lt;/span&gt;;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//发送邮件方，如xxx@163.com&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailsubject&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;用户帐号激活&quot;&lt;/span&gt;;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//邮件标题&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//邮件主体内容&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailbody&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;亲爱的&quot;&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;username&lt;/span&gt;.&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;：&amp;lt;br/&amp;gt;感谢您在我站注册了新帐号。&amp;lt;br/&amp;gt;请点击链接激活您的帐号。&amp;lt;br/&amp;gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;a&nbsp;href='http://www.helloweba.com/demo/register/active.php?verify=&quot;&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;token&lt;/span&gt;.&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;'&nbsp;target=&nbsp;
'_blank'&amp;gt;http://www.helloweba.com/demo/register/active.php?verify=&quot;&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;token&lt;/span&gt;.&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;如果以上链接无法点击，请将它复制到你的浏览器地址栏中进入访问，该链接24小时内有效。&quot;&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//发送邮件&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;rs&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtp&lt;/span&gt;-&amp;gt;sendmail(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpemailto&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;smtpemailfrom&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailsubject&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailbody&lt;/span&gt;,&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;emailtype&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;rs&lt;/span&gt;==&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;1&lt;/span&gt;){&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'恭喜您，注册成功！&amp;lt;br/&amp;gt;请登录到您的邮箱及时激活您的帐号！'&lt;/span&gt;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;else&lt;/span&gt;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;rs&lt;/span&gt;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
}&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;echo&lt;/span&gt;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;;&nbsp;</pre><p>还有一个相当好用且强大的邮件发送类分享个大家：<a style="color: #336699;" href="http://www.helloweba.com/view-blog-205.html" target="_blank">使用PHPMailer发送带附件并支持HTML内容的邮件</a>，直接可以用哦。</p>
<h4>active.php</h4>
<p>如果不出意外，您注册帐号时填写的Email将收到一封helloweba发送的邮件，这个时候您直接点击激活链接，交由active.php处理。</p>
<p>active.php接收提交的链接信息，获取参数verify的值，即激活识别码。将它与数据表中的用户信息进行查询对比，如果有相应的数据集，判断是否过期，如果在有效期内则将对应的用户表中字段status设置1，即已激活，这样就完成了激活功能。</p><pre class="crayon-plain-tag">&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;include_once&lt;/span&gt;(&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;connect.php&quot;&lt;/span&gt;);&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//连接数据库&lt;/span&gt;&nbsp;
&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;verify&lt;/span&gt;&nbsp;=&nbsp;stripslashes(trim(&lt;span class=&quot;php__global&quot; style=&quot;color: red;&quot;&gt;$_GET&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'verify'&lt;/span&gt;]));&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;nowtime&lt;/span&gt;&nbsp;=&nbsp;time();&nbsp;
&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;query&lt;/span&gt;&nbsp;=&nbsp;mysql_query(&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;select&nbsp;id,token_exptime&nbsp;from&nbsp;t_user&nbsp;where&nbsp;status='0'&nbsp;and&nbsp;&nbsp;
`token`='$verify'&quot;&lt;/span&gt;);&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;&nbsp;=&nbsp;mysql_fetch_array(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;query&lt;/span&gt;);&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;){&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;nowtime&lt;/span&gt;&amp;gt;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'token_exptime'&lt;/span&gt;]){&nbsp;&lt;span class=&quot;php__com&quot; style=&quot;color: green;&quot;&gt;//24hour&lt;/span&gt;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'您的激活有效期已过，请登录您的帐号重新发送激活邮件.'&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;else&lt;/span&gt;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mysql_query(&lt;span class=&quot;php__string2&quot; style=&quot;color: fuchsia;&quot;&gt;&quot;update&nbsp;t_user&nbsp;set&nbsp;status=1&nbsp;where&nbsp;id=&quot;&lt;/span&gt;.&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;row&lt;/span&gt;[&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'id'&lt;/span&gt;]);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;if&lt;/span&gt;(mysql_affected_rows(&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;link&lt;/span&gt;)!=&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;1&lt;/span&gt;)&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;die&lt;/span&gt;(&lt;span class=&quot;php__number&quot; style=&quot;color: red;&quot;&gt;0&lt;/span&gt;);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'激活成功！'&lt;/span&gt;;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
}&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;else&lt;/span&gt;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;&nbsp;=&nbsp;&lt;span class=&quot;php__string1&quot; style=&quot;color: purple;&quot;&gt;'error.'&lt;/span&gt;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&nbsp;
&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;echo&lt;/span&gt;&nbsp;&lt;span class=&quot;php__keyword&quot; style=&quot;font-weight: bold; color: navy;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;php__variable&quot; style=&quot;color: #4040c2;&quot;&gt;msg&lt;/span&gt;;&nbsp;</pre><p>激活成功后，发现token字段并没有用处了，您可以清空。接下来我们会讲解用户找回密码的功能，也要用到邮箱验证，敬请关注。</p>
<p>http://www.helloweba.com/view-blog-228.html</p>
</div>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1163</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP如何执行cmd命令</title>
		<link>https://www.softwareace.cn/?p=1161</link>
		<comments>https://www.softwareace.cn/?p=1161#comments</comments>
		<pubDate>Fri, 30 Jan 2015 07:40:35 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1161</guid>
		<description><![CDATA[我是在wamp包安装的环境实现的。打开php.ini，首先是关掉安全模式safe_mode = off，然后在 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="color: #7a9e9f;">我是在wamp包安装的环境实现的。打开php.ini，首先是关掉安全模式safe_mode = off，然后在看看 禁用函数列表 disable_functions = proc_open, popen, exec, system, shell_exec ，把exec去掉。</p>
<p style="color: #7a9e9f;">php文件代码如下：</p>
<div style="color: #7a9e9f;">
<div id="highlighter_967820" class="syntaxhighlighter  php">
<table style="font-weight: normal !important; font-style: normal !important;" border="0" cellspacing="0" cellpadding="0">
<tbody style="font-weight: normal !important; font-style: normal !important;">
<tr style="font-weight: normal !important; font-style: normal !important;">
<td class="gutter" style="font-weight: normal !important; font-style: normal !important; color: #afafaf !important;">
<div class="line number1 index0 alt2" style="font-weight: normal !important; font-style: normal !important;">1</div>
<div class="line number2 index1 alt1" style="font-weight: normal !important; font-style: normal !important;">2</div>
<div class="line number3 index2 alt2" style="font-weight: normal !important; font-style: normal !important;">3</div>
<div class="line number4 index3 alt1" style="font-weight: normal !important; font-style: normal !important;">4</div>
</td>
<td class="code" style="font-weight: normal !important; font-style: normal !important;">
<div class="container" style="font-weight: normal !important; font-style: normal !important;">
<div class="line number1 index0 alt2" style="font-weight: normal !important; font-style: normal !important;"><code class="php plain" style="font-weight: normal !important; font-style: normal !important; color: black !important;">&lt;?php</code></div>
<div class="line number2 index1 alt1" style="font-weight: normal !important; font-style: normal !important;"><code class="php functions" style="font-weight: normal !important; font-style: normal !important; color: #ff1493 !important;">exec</code><code class="php plain" style="font-weight: normal !important; font-style: normal !important; color: black !important;">(</code><code class="php string" style="font-weight: normal !important; font-style: normal !important; color: blue !important;">"mkdir d:\\test"</code><code class="php plain" style="font-weight: normal !important; font-style: normal !important; color: black !important;">,</code><code class="php variable" style="font-weight: normal !important; font-style: normal !important; color: #aa7700 !important;">$out</code><code class="php plain" style="font-weight: normal !important; font-style: normal !important; color: black !important;">);</code></div>
<div class="line number3 index2 alt2" style="font-weight: normal !important; font-style: normal !important;"><code class="php plain" style="font-weight: normal !important; font-style: normal !important; color: black !important;">print_r(</code><code class="php variable" style="font-weight: normal !important; font-style: normal !important; color: #aa7700 !important;">$out</code><code class="php plain" style="font-weight: normal !important; font-style: normal !important; color: black !important;">);</code></div>
<div class="line number4 index3 alt1" style="font-weight: normal !important; font-style: normal !important;"><code class="php plain" style="font-weight: normal !important; font-style: normal !important; color: black !important;">?&gt;</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p style="color: #7a9e9f;">执行该php文件，会发现在d盘下多了一个test文件夹。</p>
<p style="color: #7a9e9f;">参考文档：</p>
<p style="color: #7a9e9f;"><strong>exec函数解析</strong></p>
<p style="color: #7a9e9f;" align="left">exec语法: <strong>string exec(string command, string [array], int [return_var]);</strong></p>
<p style="color: #7a9e9f;" align="left">exec返回值: 字符串</p>
<p style="color: #7a9e9f;"><strong>exec参数说明</strong></p>
<p style="color: #7a9e9f;">Command – 需要执行的命令</p>
<p style="color: #7a9e9f;">Array –  是输出值</p>
<p style="color: #7a9e9f;"><strong>return_var –</strong>是返回值0或1，如果返回0则执行成功，返回1则执行失败。</p>
<p style="color: #7a9e9f;"><strong>exec不成功，调试方案</strong></p>
<p style="color: #7a9e9f;">一个技巧就是使用管道命令, 使用 2&gt;&amp;1, 命令就会输出shell执行时的错误到$output变量, 输出该变量即可分析。</p>
<p style="color: #7a9e9f;">如：</p>
<p style="color: #7a9e9f;">exec(‘convert a.jpg b.jpg’, $output, $return_val);</p>
<p style="color: #7a9e9f;">改为：</p>
<p style="color: #7a9e9f;" align="left">exec(‘convert a.jpg b.jpg 2&gt;&amp;1′, $output, $return_val);</p>
<p style="color: #7a9e9f;" align="left">print_r($output);</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1161</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>主流网盘地址解析流程技术分享</title>
		<link>https://www.softwareace.cn/?p=1085</link>
		<comments>https://www.softwareace.cn/?p=1085#comments</comments>
		<pubDate>Tue, 16 Dec 2014 06:02:22 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1085</guid>
		<description><![CDATA[这里拿360的网盘地址解析示范,其它的网盘解析流程差不多,有什么问题可以跟我交流.更多解析请访问: http: [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><span style="color: #000000;">这里拿360的网盘地址解析示范,其它的网盘解析流程差不多,</span><br style="color: #000000;" /><span style="color: #000000;">有什么问题可以跟我交流.</span><br style="color: #000000;" /><span style="color: #000000;">更多解析请访问: http://wpjx.dahuzhi.com/</span><br style="color: #000000;" /><span style="color: #000000;">我的博客: http://www.dahuzhi.com/</span></p><pre class="crayon-plain-tag">&lt;?php
 
//$_id = http://yunpan.cn/QTRJtjVB4QktD ;
$_id = "QTRJtjVB4QktD";
 
$_url = 'http://yunpan.cn/lk/'.$_id;
$_str = Get_Web_Contents($_url);
$_str = $_str['Header'];
 
if (preg_match('#Location: (?&lt;url&gt;http\:\/\/(?&lt;dir&gt;[\w\.]+)\.yunpan\.cn\/lk\/\w+)#',$_str,$_url) == 0){
    die('error!');
}
 
$_str = Get_Web_Contents($_url['url']);
$_str = $_str['Body'];
 
if (preg_match('#nid : '(\d+)',#s',$_str,$_nid) == 0){
    die('error!');
}
$post_string = 'surl='.$_id.'&amp;nid='.$_nid['1'];
 
$_url = 'http://'.$_url['dir'].'.yunpan.cn/share/downloadfile/';
 
$_str = Get_Web_Contents($_url, 'POST', $post_string);
 
$_str = $_str['Body'];
 
$_str = object_array(json_decode($_str));
$_url = $_str['data']['downloadurl'];
header('location:'.$_url);
 
function object_array($array){
    // 将 json_decode() 还原的数组对象转换成数组。
    if(is_object($array)){
        $array = (array)$array;
    }
    if(is_array($array)){
        foreach($array as $key=&gt;$value){
            $array[$key] = object_array($value);
        }
    }
    return $array;
}
?&gt;</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1085</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 验证URL是否合法</title>
		<link>https://www.softwareace.cn/?p=1052</link>
		<comments>https://www.softwareace.cn/?p=1052#comments</comments>
		<pubDate>Tue, 02 Dec 2014 04:21:14 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1052</guid>
		<description><![CDATA[[crayon-69df335e887cb468998776/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">public function isValidUrl() {
 
    $patern = '/^http[s]?:\/\/'.  
        '(([0-9]{1,3}\.){3}[0-9]{1,3}'.             // IP形式的URL- 199.194.52.184  
        '|'.                                        // 允许IP和DOMAIN（域名）  
        '([0-9a-z_!~*\'()-]+\.)*'.                  // 三级域验证- www.  
        '([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.'.     // 二级域验证  
        '[a-z]{2,6})'.                              // 顶级域验证.com or .museum  
        '(:[0-9]{1,4})?'.                           // 端口- :80  
        '((\/\?)|'.                                 // 如果含有文件对文件部分进行校验  
        '(\/[0-9a-zA-Z_!~\*\'\(\)\.;\?:@&amp;=\+\$,%#-\/]*)?)$/';
 
    if(!preg_match($patern, $this-&gt;url)) {
        $this-&gt;addError('url', '您输入的URL格式有问题，请检查！');
    }
}</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1052</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>比较全面的MIME类型对照表</title>
		<link>https://www.softwareace.cn/?p=965</link>
		<comments>https://www.softwareace.cn/?p=965#comments</comments>
		<pubDate>Thu, 09 Oct 2014 08:23:33 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=965</guid>
		<description><![CDATA[[crayon-69df335e88bc8233268007/]]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">MIME类型就是设定某种扩展名的文件用一种应用程序来打开的方式类型，
    当该扩展名文件被访问的时候，浏览器会自动使用指定应用程序来打开。
    多用于指定一些客户端自定义的文件名，以及一些媒体文件打开方式。

         下面列出常用的文件对应的MIME类型：
&lt;span style=&quot;color: #5285b2;&quot;&gt;
         .asx         video/x-ms-asf
         .xml         text/xml
         .tsv         text/tab-separated-values
         .ra          audio/x-pn-realaudio
         .sv4crc      application/x-sv4crc
         .spc         application/x-pkcs7-certificates
         .pmc         application/x-perfmon
         .lit         application/x-ms-reader
         .crd         application/x-mscardfile
         .isp         application/x-internet-signup
         .wmlsc       application/vnd.wap.wmlscriptc
         .vst         application/vnd.visio
         .xlam        application/vnd.ms-excel.addin.macroEnabled.12
         .ttf         application/octet-stream
         .pfm         application/octet-stream
         .csv         application/octet-stream
         .aaf         application/octet-stream
         .one         application/onenote
         .hta         application/hta
         .atom        application/atom+xml
         .323         text/h323
         .mhtml       message/rfc822
         .midi        audio/mid
         .p7r         application/x-pkcs7-certreqresp
         .mny         application/x-msmoney
         .clp         application/x-msclip
         .vsd         application/vnd.visio
         .lpk         application/octet-stream
         .bin         application/octet-stream
         .onetoc      application/onenote
         .x           application/directx
         .wvx         video/x-ms-wvx
         .vcf         text/x-vcard
         .htc         text/x-component
         .htt         text/webviewhtml
         .h           text/plain
         .mht         message/rfc822
         .mid         audio/mid

         .p7b         application/x-pkcs7-certificates
         .gz          application/x-gzip
         .dvi         application/x-dvi
         .cpio        application/x-cpio
         .vdx         application/vnd.ms-visio.viewer
         .sldm        application/vnd.ms-powerpoint.slide.macroEnabled.12
         .xlm         application/vnd.ms-excel
         .fdf         application/vnd.fdf
         .setreg      application/set-registration-initiation
         .eps         application/postscript
         .p7s         application/pkcs7-signature
         .toc         application/octet-stream
         .mdp         application/octet-stream
         .ics         application/octet-stream
         .chm         application/octet-stream
         .asi         application/octet-stream
         .afm         application/octet-stream
         .evy         application/envoy
         .wmp         video/x-ms-wmp
         .qt          video/quicktime
         .mpv2        video/mpeg
         .xslt        text/xml
         .etx         text/x-setext
         .cod         image/cis-cod
         .snd         audio/basic
         .au          audio/basic
         .man         application/x-troff-man
         .qtl         application/x-quicktimeplayer
         .pmw         application/x-perfmon
         .class       application/x-java-applet
         .iii         application/x-iphone
         .csh         application/x-csh
         .z           application/x-compress
         .vtx         application/vnd.visio
         .vsw         application/vnd.visio
         .wps         application/vnd.ms-works
         .potx       application/vnd.openxmlformats-officedocument.presentationml.template
         .ps          application/postscript
         .p7c         application/pkcs7-mime
         .thn         application/octet-stream
         .mso         application/octet-stream
         .dot         application/msword
         .doc         application/msword
         .sgml        text/sgml

         .nws         message/rfc822
         .pbm         image/x-portable-bitmap
         .ief         image/ief
         .wav         audio/wav
         .texi        application/x-texinfo
         .mvb         application/x-msmediaview
         .hdf         application/x-hdf
         .vsx         application/vnd.visio
         .dotm        application/vnd.ms-word.template.macroEnabled.12
         .docm        application/vnd.ms-word.document.macroEnabled.12
         .pptx        application/vnd.openxmlformats-officedocument.presentationml.presentation
         .psm         application/octet-stream
         .java        application/octet-stream
         .eot         application/octet-stream
         .jar         application/java-archive
         .mpeg        video/mpeg
         .xsf         text/xml
         .map         text/plain
         .uls         text/iuls
         .rf          image/vnd.rn-realflash
         .m3u         audio/x-mpegurl
         .wma         audio/x-ms-wma
         .aifc        audio/aiff
         .mdb         application/x-msaccess
         .mvc         application/x-miva-compiled
         .stl         application/vnd.ms-pki.stl
         .ppsx     application/vnd.openxmlformats-officedocument.presentationml.slideshow
         .xlsb        application/vnd.ms-excel.sheet.binary.macroEnabled.12
         .setpay      application/set-payment-initiation
         .prm         application/octet-stream
         .mix         application/octet-stream
         .lzh         application/octet-stream
         .hhk         application/octet-stream
         .onepkg      application/onenote
         .xaf         x-world/x-vrml
         .flr         x-world/x-vrml
         .IVF         video/x-ivf
         .cnf         text/plain
         .asm         text/plain
         .tiff        image/tiff
         .wax         audio/x-ms-wax
         .ms          application/x-troff-ms
         .tcl         application/x-tcl
         .shar        application/x-shar
         .sh          application/x-sh
         .nc          application/x-netcdf
         .hlp         application/winhlp
         .oda         application/oda
         .pfb         application/octet-stream
         .fla         application/octet-stream
         .wm          video/x-ms-wm
         .rgb         image/x-rgb

         .ppm         image/x-portable-pixmap
         .ram         audio/x-pn-realaudio
         .sit         application/x-stuffit
         .dir         application/x-director
         .mpp         application/vnd.ms-project
         .xla         application/vnd.ms-excel
         .ssm         application/streamingmedia
         .axs         application/olescript
         .ods         application/oleobject
         .psp         application/octet-stream
         .jpb         application/octet-stream
         .wrz         x-world/x-vrml
         .m1v         video/mpeg
         .mno         text/xml
         .cmx         image/x-cmx
         .jpeg        image/jpeg
         .dib         image/bmp
         .rmi         audio/mid
         .aiff        audio/aiff
         .wmd         application/x-ms-wmd
         .wri         application/x-mswrite
         .pub         application/x-mspublisher
         .ins         application/x-internet-signup
         .wks         application/vnd.ms-works
         .xls         application/vnd.ms-excel
         .ai          application/postscript
         .crl         application/pkix-crl
         .qxd         application/octet-stream
         .dwp         application/octet-stream
         .xof         x-world/x-vrml
         .wmv         video/x-ms-wmv
         .nsc         video/x-ms-asf
         .mpa         video/mpeg
         .pnm         image/x-portable-anymap
         .rpm         audio/x-pn-realaudio-plugin
         .aif         audio/x-aiff
         .me          application/x-troff-me
         .pml         application/x-perfmon
         .trm         application/x-msterminal
         .m13         application/x-msmediaview
         .js          application/x-javascript

         .dxr         application/x-director
         .potm        application/vnd.ms-powerpoint.template.macroEnabled.12
         .xltx     application/vnd.openxmlformats-officedocument.spreadsheetml.template
         .xlt         application/vnd.ms-excel
         .xlc         application/vnd.ms-excel
         .p10         application/pkcs10
         .smi         application/octet-stream
         .sea         application/octet-stream
         .hqx         application/mac-binhex40
         .spl         application/futuresplash
         .movie       video/x-sgi-movie
         .lsf         video/x-la-asf
         .txt         text/plain
         .jfif        image/pjpeg
         .jpe         image/jpeg
         .zip         application/x-zip-compressed
         .wmf         application/x-msmetafile
         .m14         application/x-msmediaview
         .latex       application/x-latex
         .wcm         application/vnd.ms-works
         .pptm     application/vnd.ms-powerpoint.presentation.macroEnabled.12
         .xlsx     application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
         .hhp         application/octet-stream
         .aca         application/octet-stream
         .accdb       application/msaccess
         .jcz         application/liquidmotion
         .wrl         x-world/x-vrml
         .wmx         video/x-ms-wmx
         .asr         video/x-ms-asf
         .lsx         video/x-la-asf
         .xsl         text/xml
         .html        text/html
         .tif         image/tiff
         .der         application/x-x509-ca-cert
         .pfx         application/x-pkcs12
         .p12         application/x-pkcs12
         .ppsm        application/vnd.ms-powerpoint.slideshow.macroEnabled.12
         .cur         application/octet-stream
         .accdt       application/msaccess
         .hdml        text/x-hdml
         .htm         text/html
         .xbm         image/x-xbitmap
         .jpg         image/jpeg
         .texinfo     application/x-texinfo
         .ppam        application/vnd.ms-powerpoint.addin.macroEnabled.12
         .xlw         application/vnd.ms-excel
         .rm          application/vnd.rn-realmedia
         .pdf         application/pdf

         .rar         application/octet-stream
         .psd         application/octet-stream
         .inf         application/octet-stream
         .emz         application/octet-stream
         .dsp         application/octet-stream
         .onea        application/onenote
         .jck         application/liquidmotion
         .mpe         video/mpeg
         .mp2         video/mpeg
         .sct         text/scriptlet
         .ras         image/x-cmu-raster
         .swf         application/x-shockwave-flash
         .wmz         application/x-ms-wmz
         .gtar        application/x-gtar
         .dcr         application/x-director
         .sldx    application/vnd.openxmlformats-officedocument.presentationml.slide
         .pps         application/vnd.ms-pps
         .p7m         application/pkcs7-mime
         .xsn         application/octet-stream
         .ocx         application/octet-stream
         .accde       application/msaccess
         .mov         video/quicktime
         .wmls        text/vnd.wap.wmlscript
         .cpp         text/plain
         .c           text/plain
         .bas         text/plain
         .css         text/css
         .art         image/x-jg
         .mp3         audio/mpeg
         .t           application/x-troff
         .roff        application/x-troff
         .tar         application/x-tar
         .hhc         application/x-oleobject
         .scd         application/x-msschedule
         .pko         application/vnd.ms-pki.pko
         .sst         application/vnd.ms-pki.certstore
         .ppt         application/vnd.ms-powerpoint
         .xtp         application/octet-stream
         .u32         application/octet-stream
         .pcx         application/octet-stream
         .msi         application/octet-stream
         .exe         application/octet-stream
         .asd         application/octet-stream
         .onetoc2         application/onenote
         .fif         application/fractals
         .mpg         video/mpeg
         .vml         text/xml
         .xdr         text/plain
         .vcs         text/plain
         .hxt         text/html
         .eml         message/rfc822
         .xpm         image/x-xpixmap
         .ico         image/x-icon
         .gif         image/gif
         .dwf         drawing/x-dwf
         .src         application/x-wais-source
         .tr          application/x-troff
         .pmr         application/x-perfmon
         .pma         application/x-perfmon
         .dll         application/x-msdownload
         .bcpio       application/x-bcpio
         .wmlc        application/vnd.wap.wmlc
         .wdb         application/vnd.ms-works
         .dotx    application/vnd.openxmlformats-officedocument.wordprocessingml.template
         .docx    application/vnd.openxmlformats-officedocument.wordprocessingml.document
         .pot         application/vnd.ms-powerpoint
         .xltm        application/vnd.ms-excel.template.macroEnabled.12
         .rtf         application/rtf
         .prf         application/pics-rules
         .snp .cab    application/octet-stream
         .avi         video/x-msvideo
         .asf         video/x-ms-asf
         .dtd         text/xml
         .wml         text/vnd.wap.wml
         .vbs         text/vbscript
         .rtx         text/richtext
         .dlm         text/dlm
         .xwd         image/x-xwindowdump
         .pgm         image/x-portable-graymap
         .bmp         image/bmp
         .crt         application/x-x509-ca-cert
         .ustar       application/x-ustar
         .tex         application/x-tex
         .sv4cpio       application/x-sv4cpio
         .tgz         application/x-compressed
         .cdf         application/x-cdf
         .vss         application/vnd.visio
         .cat         application/vnd.ms-pki.seccat
         .thmx        application/vnd.ms-officetheme
         .xlsm        application/vnd.ms-excel.sheet.macroEnabled.12
         .prx         application/octet-stream
         .pcz         application/octet-stream
         .onetmp      application/onenote
         .acx         application/internet-property-stream
         .wsdl        text/xml
         .disco       text/xml
         .xsd         text/xml
         .wbmp        image/vnd.wap.wbmp
         .png         image/png
         .pnz         image/png
         .smd         audio/x-smd
         .smz         audio/x-smd
         .smx         audio/x-smd
         .mmf         application/x-smaf
         &lt;/span&gt;</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=965</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
