<?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>The Townes &#187; PHP函数ereg()</title>
	<atom:link href="https://thetownes.coolpage.biz/?feed=rss2&#038;tag=php%E5%87%BD%E6%95%B0ereg" rel="self" type="application/rss+xml" />
	<link>https://thetownes.coolpage.biz</link>
	<description>本站已转移至：http://www.thetownes.info</description>
	<lastBuildDate>Thu, 01 Aug 2013 11:49:56 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2</generator>
		<item>
		<title>浅析PHP函数ereg()的具体使用方法</title>
		<link>https://thetownes.coolpage.biz/?p=290</link>
		<comments>https://thetownes.coolpage.biz/?p=290#comments</comments>
		<pubDate>Sat, 13 Jul 2013 03:10:43 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP函数ereg()]]></category>

		<guid isPermaLink="false">http://thetownes.coolpage.biz/?p=290</guid>
		<description><![CDATA[在许多高级语言中，PHP算是一个佼佼者，它的灵活和有效性还有强大的功能都吸引了很 &#8230; <a href="https://thetownes.coolpage.biz/?p=290">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>在许多高级语言中，<a href="http://developer.51cto.com/art/200810/94162.htm">PHP</a>算是一个佼佼者，它的灵活和有效性还有强大的功能都吸引了很多拥护者们。今天我们就向大家具体讲讲有关PHP函数ereg()的应用方法，希望对有需要的朋友有所帮助。</p>
<p>&nbsp;</p>
<div>
<ul>
<li><a href="http://developer.51cto.com/art/200911/165276.htm" target="_blank">PHP字符串替换函数strtr()的功能实现讲解</a></li>
<li><a href="http://developer.51cto.com/art/200911/165282.htm" target="_blank">PHP中文处理工具函数的用法总结</a></li>
<li><a href="http://developer.51cto.com/art/200911/165290.htm" target="_blank">PHP正则模式修正符的具体应用方式分析</a></li>
<li><a href="http://developer.51cto.com/art/200911/165297.htm" target="_blank">PHP函数echo()的定义和用法解析</a></li>
<li><a href="http://developer.51cto.com/art/200911/165310.htm" target="_blank">三个PHP调用系统命令函数的区别与联系</a></li>
</ul>
</div>
<p>语法: int ereg(string pattern, string string, array [regs]);</p>
<p>&nbsp;</p>
<p>返回值: 整数/数组</p>
<p>函数种类: 资料处理</p>
<p><strong>PHP函数ereg()内容说明</strong></p>
<p>本函数以 pattern 的规则来解析比对字符串 string。比对结果返回的值放在数组参数 regs 之中，regs[0] 内容就是原字符串 string、regs[1] 为第一个合乎规则的字符串、regs[2] 就是第二个合乎规则的字符串，余类推。若省略参数 regs，则只是单纯地比对，找到则返回值为 true。</p>
<p><strong>PHP函数ereg()使用范例</strong></p>
<p>简单例子：</p>
<ol>
<li>&lt;&nbsp;?php</li>
<li>if&nbsp;(ereg(“c”,”abcdef”)){<br />
//说明：判断abcdef中是否含有字母c</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;”通过”;</li>
<li>}else{</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;”错误”;</li>
<li>}</li>
<li>?&gt;</li>
</ol>
<p>下面这个PHP函数ereg()例子是对输入的 E-Mail 作简单的检查，检查使用者的 E-Mail 字符串是否有 @ 字符，在 @ 字符前有英文字母或数字，在之后有数节字符串，最后的小数点后只能有二个或三个英文字母。super@mail.wilson.gs就可以通过检查，super@mail.wilson就不能通过检查。</p>
<ol>
<li>&lt;&nbsp;?php</li>
<li>if&nbsp;(ereg(“^[_.0-9a-z-]+@([0-9a-z]<br />
[0-9a-z-]+.)+[a-z]{2,3}$”,$email))</li>
<li>&nbsp;{</li>
<li>&nbsp;&nbsp;&nbsp;echo&nbsp;”您的&nbsp;E-Mail&nbsp;通过初步检查”;</li>
<li>}</li>
<li>?&gt;</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>https://thetownes.coolpage.biz/?feed=rss2&#038;p=290</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
