<?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="http://www.xuandun.net/category/php%e7%ac%94%e8%ae%b0/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xuandun.net</link>
	<description>因为一些原因，本博客无限期暂停更新！</description>
	<lastBuildDate>Tue, 10 Aug 2010 05:19:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>php Session函数及用法</title>
		<link>http://www.xuandun.net/159/</link>
		<comments>http://www.xuandun.net/159/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 01:50:11 +0000</pubDate>
		<dc:creator>炫盾</dc:creator>
				<category><![CDATA[PHP笔记]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xuandun.net/?p=159</guid>
		<description><![CDATA[其实我就是把手册抄一下，然后每个都试试然后写出来，方便自己查阅滴，谁让咱刚学呢。Session大概有12个函数分别是]]></description>
			<content:encoded><![CDATA[<p>其实我就是把手册抄一下，然后每个都试试然后写出来，方便自己查阅滴，谁让咱刚学呢。Session大概有12个函数分别是：</p>
<p class="code">session_start:	初始 session。<br />
session_destroy:	结束 session。<br />
session_unset: 释放session内存。<br />
session_name:	存取目前 session 名称。<br />
session_module_name:	存取目前 session 模块。<br />
session_save_path:	存取目前 session 路径。<br />
session_id:	存取目前 session 代号。<br />
session_register:	注册新的变量。<br />
session_unregister:	删除已注册变量。<br />
session_is_registered:	检查变量是否注册。<br />
session_decode:	Session 资料解码。<br />
session_encode:	Session 资料编码。<br />
还有个全局变量就是：$_SESSION</p>
<p>我暂时不考虑版本问题，需要这方面信息的请查看这里http://www.phpv.net/html/292.html</p>
<p>1.session_start()<br />
这个函数摘要用来开始操作session的必要语句，必须再最前(如果有html必须在html最前，因为他也是启动之前不能有任何输出)，如果当前客户已经有session的写入，就连接上这个原有的。</p>
<p>2.session_destroy()<br />
这个函数用来删除当前用户对应的session文件以及释放session id，内存中的$_SESSION变量内容依然保留。如果需要彻底终结session请先运行下面的函数然后运行这个。</p>
<p>3.session_unset()<br />
这个函数可以释放当前在内存中已经创建的<strong>所有</strong>$_SESSION变量，但不删除session文件以及不释放对应的session id，配合上面的函数可以彻底终结session。</p>
<p>4.session_name(string [name])<br />
可以获取或配置session_name，也就是当前session的名称。</p>
<pre class="brush: php;">
session_name(&quot;xuandun&quot;);
echo &quot;现在是：&quot;.session_name();
</pre>
<p>5.session_module_name(string [module])<br />
本函数可取得或者重新配置目前 Session 的模块。若无参数 module 则表示只获取目前 Session 的模块，加上参数则表示将 Session 模块设为参数 module。</p>
<p>6.session_save_path(string [path])<br />
本函数可取得或者重新配置目前存放 Session 的路径。若无参数 path 则表示只有取得目前 Session 的路径目录名，加上参数 path 则表示将 Session 存在新的 path 上。(保证目录存在并且注意权限)</p>
<p>7.string session_id(string [id])<br />
本函数可取得或者重新配置目前存放 Session 的代号。若无参数 id 则表示只有取得目前 Session 的代号，加上参数则表示将 Session 代号设成新指定的 id。输入及返回均为字符串。</p>
<p>8.session_register(string name)<br />
本函数在全域变量中增加一个变量到目前的 Session 之中。参数 name 即为欲加入的变量名。</p>
<p>9.session_unregister(string name)<br />
本函数在目前的 Session 之中删除全域变量上的变量。参数 name 即为欲删除的变量名。</p>
<p>10.session_is_registered(string name)<br />
本函数可检查目前的 Session 之中是否已有指定的变量注册。参数 name 即为欲检查的变量名。</p>
<p>11.session_decode(string data)<br />
本函数可将 Session 资料解码。参数 data 即为欲解码的资料。成功则返回 true 值。</p>
<p>12.session_encode(void)<br />
本函数可将 Session 资料编码，编码以 ZEND 引擎做哈稀编码。本函数没有参数。成功则返回 true 值</p>
<p>13.$_SESSION<br />
获取储存的session值例如$_SESSION['userid']</p>
<p>因为我也不是很懂，从3项以后我都没实际用到过。下面我简单写个例子来实现简单的session验证</p>
<pre class="brush: php;">&lt;?php
session_start();
switch ( $_GET['action'] ){
case &quot;loginif&quot;;
//登陆验证,假定session储存的秘密应该等于123才为正确
if ($_SESSION['pass']==&quot;123&quot;){echo &quot;密码正确 您可以执行注销&quot;;}else{echo &quot;密码错误，您可以重新登陆&quot;;}
break;
case &quot;logout&quot;;
//注销登陆
session_unset();
session_destroy();
echo &quot;注销成功！可以判断一下密码是否正确来看看是不是成功注销&quot;;
break;
case &quot;login&quot;;
//写入session以供验证，
$pass=&quot;123&quot;;//密码
$_SESSION['pass']=$pass;
echo  &quot;写入登陆密码了 去判断密码成功与否吧。&quot;;
break;
}
?&gt;
&lt;p&gt;假定本页名为temp.php &lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;temp.php?action=login&quot;&gt;用户进行登陆post，程序处理写入session&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;temp.php?action=loginif&quot;&gt;判断用户密码是否正确&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;temp.php?action=logout&quot;&gt;登陆成功的用户注销登陆&lt;/a&gt;&lt;/p&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xuandun.net/159/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fckeditor 在php下的使用</title>
		<link>http://www.xuandun.net/69/</link>
		<comments>http://www.xuandun.net/69/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 09:42:53 +0000</pubDate>
		<dc:creator>炫盾</dc:creator>
				<category><![CDATA[PHP笔记]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xuandun.net/?p=69</guid>
		<description><![CDATA[其实很简单啦，在asp用过。<br/>在fckeditor的压缩包里就有使用例子<br/>
]]></description>
			<content:encoded><![CDATA[<p>其实很简单啦，在asp用过.<br />
在fckeditor的压缩包里就有使用例子,做个笔记先.<br />
fckeditor是超级强大的但是我还不太需要那么多功能，so我从sa-blog下的精简版用他的例子来解释一下&#8230;</p>
<pre class="brush: php;">include('fckeditor.php') ; //拿进来
$sBasePath = $_SERVER['PHP_SELF'] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, &quot;_samples&quot; ) ) ;
//以上是获取目录路径，来指定BasePath，也可以直接就去修改它的文件这样就不用这个步骤了，不过如果换了位置就还需要修改，所以一般还是写下吧。这个段最终结果是空....,也可以用下面的方法
//$sBasePath = $_SERVER['PHP_SELF'] ;
//$sBasePath = dirname($sBasePath).'/';
$oFCKeditor = new FCKeditor('data1') ;//实例化它 指定name=data1
$oFCKeditor-&amp;gt;BasePath  = $sBasePath ;//把获得的路径给它
$oFCKeditor-&amp;gt;Width  = '100%' ;//宽度百分比值都行
$oFCKeditor-&amp;gt;Height  = '700' ;//高度 同上
$oFCKeditor-&amp;gt;ToolbarSet = 'Default';//Default完全或Basic简单模式
$oFCKeditor-&amp;gt;Value = '';//初始化内容
$oFCKeditor-&amp;gt;Create() ;//显示吧
</pre>
<p>上传功能一个是安全考虑（貌似其实fck很安全了），另一个是权限和放置区域的要求还是自己开发吧用js方法可以插入进去。<br />
好了一个简单的编辑器搞定了。以下是更多的fckconfig.js配置方法，拷贝滴</p>
<p class="code">FCKConfig.CustomConfigurationsPath = &#8221;&#8221; ; // 自定义配置文件路径和名称<br />
FCKConfig.EditorAreaCSS = FCKConfig.BasePath + &#8221;css/fck_editorarea.css&#8221;; // 编辑区的样式表文件<br />
FCKConfig.EditorAreaStyles = &#8221;&#8221; ; // 编辑区的样式表风格<br />
FCKConfig.ToolbarComboPreviewCSS =&#8221;&#8221;; //工具栏预览CSS<br />
FCKConfig.DocType = &#8221;&#8221; ;//文档类型<br />
FCKConfig.BaseHref = &#8221;&#8221;; // 相对链接的基地址<br />
FCKConfig.FullPage = false ; //是否允许编辑整个HTML文件,还是仅允许编辑BODY间的内容<br />
FCKConfig.StartupShowBlocks = false ;//决定是否启用&#8221;显示模块&#8221;<br />
FCKConfig.Debug = false ;//是否开启调试功能<br />
FCKConfig.SkinPath = FCKConfig.BasePath + &#8216;&#8217;skins/default/&#8221; ; //皮肤路径<br />
FCKConfig.PreloadImages=&#8230; //预装入的图片<br />
FCKConfig.PluginsPath = FCKConfig.BasePath + &#8221;plugins/&#8221; ; //插件路径<br />
FCKConfig.AutoDetectLanguage = true ; //是否自动检测语言<br />
FCKConfig.DefaultLanguage  = &#8221;zh-cn&#8221; ; //默认语言<br />
FCKConfig.ContentLangDirection = &#8221;ltr&#8221; ; //默认的文字方向,可选&#8221;ltr/rtl&#8221;,即从左到右或从右到左<br />
FCKConfig.ProcessHTMLEntities = true ; //处理HTML实体<br />
FCKConfig.IncludeLatinEntities = true ; //包括拉丁文<br />
FCKConfig.IncludeGreekEntities = true ;//包括希腊文<br />
FCKConfig.ProcessNumericEntities = false ;//处理数字实体<br />
FCKConfig.AdditionalNumericEntities = &#8221;&#8221;  ;  //附加的数字实体<br />
FCKConfig.FillEmptyBlocks = true ; //是否填充空块<br />
FCKConfig.FormatSource  = true ; //在切换到代码视图时是否自动格式化代码<br />
FCKConfig.FormatOutput  = true ; //当输出内容时是否自动格式化代码<br />
FCKConfig.FormatIndentator = &#8221;    &#8221; ; //当在源码格式下缩进代码使用的字符<br />
FCKConfig.StartupFocus = false ; //开启时焦点是否到编辑器,即打开页面时光标是否停留在fckeditor上<br />
FCKConfig.ForcePasteAsPlainText = false ; //是否强制粘贴为纯文件内容<br />
FCKConfig.AutoDetectPasteFromWord = true ; //是否自动探测从word粘贴文件,仅支持IE<br />
FCKConfig.ShowDropDialog = true ;//是否显示下拉菜单<br />
FCKConfig.ForceSimpleAmpersand = false ;//是否不把&amp;符号转换为XML实体<br />
FCKConfig.TabSpaces  = 0 ;//按下Tab键时光标跳格数,默认值为零为不跳格<br />
FCKConfig.ShowBorders = true ;//合并边框<br />
FCKConfig.SourcePopup = false ;//弹出<br />
FCKConfig.ToolbarStartExpanded = true ;//启动fckeditor工具栏默认是否展开<br />
FCKConfig.ToolbarCanCollapse = true ;//是否允许折叠或展开工具栏<br />
FCKConfig.IgnoreEmptyParagraphValue = true ;//是否忽略空的段落值<br />
FCKConfig.FloatingPanelsZIndex = 10000 ;//浮动面板索引<br />
FCKConfig.HtmlEncodeOutput = false ;//是否将HTML编码输出<br />
FCKConfig.TemplateReplaceAll = true ;//是否替换所有模板<br />
FCKConfig.ToolbarLocation = &#8221;In&#8221; ;//工具栏位置,<br />
FCKConfig.CustomConfigurationsPath = &#8221;&#8221; ; // 自定义配置文件路径和名称<br />
FCKConfig.EditorAreaCSS = FCKConfig.BasePath + &#8221;css/fck_editorarea.css&#8221;; // 编辑区的样式表文件<br />
FCKConfig.BaseHref = &#8221;&#8221;; // 相对链接的基地址<br />
FCKConfig.Debug = true/false; // 是否开启调试功能，当调用FCKDebug.Output()时，会在调试窗中输出内容<br />
FCKConfig.SkinPath = FCKConfig.BasePath + &#8216;&#8217;skins/default/&#8221;; // 设置皮肤<br />
FCKConfig.AutoDetectLanguage = true/false ; // 是否自动检测语言<br />
FCKConfig.DefaultLanguage = &#8221;zh-cn&#8221; ; // 设置默认语言<br />
FCKConfig.ContentLangDirection = &#8221;ltr/rtr&#8221;; // 默认文字方向，ltr左，rtr右<br />
FCKConfig.FillEmptyBlocks = true/false ; // 使用这个功能，可以将空的块级元素用空格来替代<br />
FCKConfig.FormatSource = true/false; // 切换到代码视图时，是否自动格式化代码<br />
FCKConfig.FormatOutput = true/false; // 当输出内容时是否自动格式化代码<br />
FCKConfig.FormatIndentator = &#8220;&#8221;; // 当在“源码格式”下缩进代码使用的字符<br />
FCKConfig.GeckoUseSPAN = true/false; // 是否允许SPAN标记代替B，I，U标记<br />
FCKConfig.StartupFocus = true/false; // 开启时是否FOCUS到编辑器<br />
FCKConfig.ForcePasteAsPlainText = true/false;// 强制粘贴为纯文本<br />
FCKConfig.ForceSimpleAmpersand = true/false; // 是否不把&amp;符号转换为XML实体<br />
FCKConfig.TabSpaces = 0/1; // TAB是否有效<br />
FCKConfig.TabSpaces = 4; // TAB键产生的空格字符数<br />
FCKConfig.ShowBorders = true/false; // 是否合并边框<br />
FCKConfig.ToolbarStartExpanded = true/false; // 页面载入时，工具栏是否展开，点“展开工具栏”时才出现<br />
FCKConfig.ToolBarCanCollapse = true/false; // 是否允许展开折叠工具栏<br />
FCKConfig.ToolbarSets = object ; // 编辑器的工具栏，可以自行定义，删减，可参考已存在工具栏<br />
FCKConfig.EnterMode = &#8221;p&#8221;; // 编辑器中直接回车，在代码中生成，可选为p | div | br<br />
FCKConfig.ShiftEnterMode = &#8221;br&#8221;; // 编辑器中Shift+回车，在代码中生成，可选为p | div | br<br />
FCKConfig.ContextMenu =&amp;nbs<br />
p;字符串数组; // 右键菜单的内容<br />
FCKConfig.FontColors = &#8220;&#8221;; // 文字颜色列表<br />
FCKConfig.FontNames = &#8220;&#8221;; // 字体列表<br />
FCKConfig.FontSizes = &#8220;&#8221;; // 字号列表<br />
FCKConfig.FontFormats = &#8220;&#8221;; // 文字格式列表<br />
FCKConfig.StylesXmlPath = &#8220;&#8221;; // CSS样式列表的XML文件的位置<br />
FCKConfig.TemplatesXmlPath = &#8220;&#8221;; // 模版的XML文件位置<br />
FCKConfig.SpellChecker = &#8220;ieSpell/Spellerpages&#8221;; // 拼写检查器<br />
FCKConfig.IeSpellDownloadUrl = &#8220;&#8221;; // 下载拼写检查器的网址<br />
FCKConfig.SmileyPath = FCKConfig.BasePath + &#8221;images/smiley/msn/&#8221;; // 表情文件存放路径<br />
FCKConfig.SmileyImages = &#8221;&#8221;; // 表情文件名称列表，具体参考默认设置<br />
FCKConfig.SmileyColumns = 8; // 表情窗口显示表情列数<br />
FCKConfig.SmileyWindowWidth = 320; // 表情窗口显示宽度，此窗口会因为表情文件的改变而作调整<br />
FCKConfig.SmileyWindowHeight = 240; // 表情窗口显示高度，此窗口会因为表情文件的改变而作调整<br />
FCKConfig.FullPage = true/false; // 是否允许编辑整个HTML文件，还是仅允许编辑BODY间的内容</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xuandun.net/69/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP中操作MySQL的函数转载</title>
		<link>http://www.xuandun.net/68/</link>
		<comments>http://www.xuandun.net/68/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 17:07:14 +0000</pubDate>
		<dc:creator>炫盾</dc:creator>
				<category><![CDATA[PHP笔记]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xuandun.net/?p=68</guid>
		<description><![CDATA[<p>基础差不多都看了，下一步是比较难以理解的东东了，很多很多，还有关于linux的部分.... 最烦人的就是还是要去逐条的读一遍php超多的函数...                            函数             描述             PHP</p>
]]></description>
			<content:encoded><![CDATA[<p>原文地址是：http://www.w3school.com.cn/php/php_ref_mysql.asp </p>
<p>基础差不多都看了，下一步是比较难以理解的东东了，很多很多，还有关于linux的部分&#8230;. 最烦人的就是还是要去逐条的读一遍php超多的函数&#8230;</p>
<table>
<tbody>
<tr>
<th>
<p>函数</p>
</th>
<th>描述</th>
<th>PHP</th>
</tr>
<tr>
<td>mysql_affected_rows()</td>
<td>取得前一次 MySQL 操作所影响的记录行数。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_change_user()</td>
<td>不赞成。改变活动连接中登录的用户</td>
<td>3</td>
</tr>
<tr>
<td>mysql_client_encoding()</td>
<td>返回当前连接的字符集的名称</td>
<td>4</td>
</tr>
<tr>
<td>mysql_close()</td>
<td>关闭非持久的 MySQL 连接。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_connect()</td>
<td>打开非持久的 MySQL 连接。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_create_db()</td>
<td>不赞成。新建 MySQL 数据库。使用 mysql_query() 代替。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_data_seek()</td>
<td>移动记录指针。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_db_name()</td>
<td>从对 mysql_list_dbs() 的调用返回数据库名称。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_db_query()</td>
<td>不赞成。发送一条 MySQL 查询。
<p>使用 mysql_select_db() 和 mysql_query() 代替。</p>
</td>
<td>3</td>
</tr>
<tr>
<td>mysql_drop_db()</td>
<td>不赞成。丢弃（删除）一个 MySQL 数据库。
<p>使用 mysql_query() 代替。</p>
</td>
<td>3</td>
</tr>
<tr>
<td>mysql_errno()</td>
<td>返回上一个 MySQL 操作中的错误信息的数字编码。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_error()</td>
<td>返回上一个 MySQL 操作产生的文本错误信息。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_escape_string()</td>
<td>不赞成。转义一个字符串用于 mysql_query。
<p>使用 mysql_real_escape_string() 代替。</p>
</td>
<td>4</td>
</tr>
<tr>
<td>mysql_fetch_array()</td>
<td>从结果集中取得一行作为关联数组，或数字数组，或二者兼有。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_fetch_assoc()</td>
<td>从结果集中取得一行作为关联数组。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_fetch_field()</td>
<td>从结果集中取得列信息并作为对象返回。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_fetch_lengths()</td>
<td>取得结果集中每个字段的内容的长度。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_fetch_object()</td>
<td>从结果集中取得一行作为对象。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_fetch_row()</td>
<td>从结果集中取得一行作为数字数组。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_field_flags()</td>
<td>从结果中取得和指定字段关联的标志。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_field_len()</td>
<td>返回指定字段的长度。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_field_name()</td>
<td>取得结果中指定字段的字段名。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_field_seek()</td>
<td>将结果集中的指针设定为指定的字段偏移量。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_field_table()</td>
<td>取得指定字段所在的表名。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_field_type()</td>
<td>取得结果集中指定字段的类型。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_free_result()</td>
<td>释放结果内存。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_get_client_info()</td>
<td>取得 MySQL 客户端信息。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_get_host_info()</td>
<td>取得 MySQL 主机信息。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_get_proto_info()</td>
<td>取得 MySQL 协议信息。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_get_server_info()</td>
<td>取得 MySQL 服务器信息。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_info()</td>
<td>取得最近一条查询的信息。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_insert_id()</td>
<td>取得上一步 INSERT 操作产生的 ID。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_list_dbs()</td>
<td>列出 MySQL 服务器中所有的数据库。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_list_fields()</td>
<td>不赞成。列出 MySQL 结果中的字段。
<p>使用 mysql_query() 代替。</p>
</td>
<td>3</td>
</tr>
<tr>
<td>mysql_list_processes()</td>
<td>列出 MySQL 进程。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_list_tables()</td>
<td>不赞成。列出 MySQL 数据库中的表。
<p>使用Use mysql_query() 代替。</p>
</td>
<td>3</td>
</tr>
<tr>
<td>mysql_num_fields()</td>
<td>取得结果集中字段的数目。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_num_rows()</td>
<td>取得结果集中行的数目。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_pconnect()</td>
<td>打开一个到 MySQL 服务器的持久连接。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_ping()</td>
<td>Ping 一个服务器连接，如果没有连接则重新连接。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_query()</td>
<td>发送一条 MySQL 查询。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_real_escape_string()</td>
<td>转义 SQL 语句中使用的字符串中的特殊字符。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_result()</td>
<td>取得结果数据。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_select_db()</td>
<td>选择 MySQL 数据库。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_stat()</td>
<td>取得当前系统状态。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_tablename()</td>
<td>不赞成。取得表名。使用 mysql_query() 代替。</td>
<td>3</td>
</tr>
<tr>
<td>mysql_thread_id()</td>
<td>返回当前线程的 ID。</td>
<td>4</td>
</tr>
<tr>
<td>mysql_unbuffered_query()</td>
<td>向 MySQL 发送一条 SQL 查询（不获取 / 缓存结果）。</td>
<td>4</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.xuandun.net/68/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php星期几的获取</title>
		<link>http://www.xuandun.net/66/</link>
		<comments>http://www.xuandun.net/66/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 07:36:25 +0000</pubDate>
		<dc:creator>炫盾</dc:creator>
				<category><![CDATA[PHP笔记]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xuandun.net/?p=66</guid>
		<description><![CDATA[简单的获取星期几，其实就是date函数的用法
]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">date(&quot;l&quot;);
//data就可以获取英文的星期比如Sunday
date(&quot;w&quot;);
//这个可以获取数字星期比如123，注意0是星期日</pre>
<p>获取中文星期可以这样</p>
<pre class="brush: php;">$weekarray=array(&quot;日&quot;,&quot;一&quot;,&quot;二&quot;,&quot;三&quot;,&quot;四&quot;,&quot;五&quot;,&quot;六&quot;);
echo &quot;星期&quot;.$weekarray[date(&quot;w&quot;)];</pre>
<p>获取指定日期是：</p>
<pre class="brush: php;">$weekarray=array(&quot;日&quot;,&quot;一&quot;,&quot;二&quot;,&quot;三&quot;,&quot;四&quot;,&quot;五&quot;,&quot;六&quot;);
echo &quot;星期&quot;.$weekarray[date(&quot;w&quot;,&quot;2011-11-11&quot;)];</pre>
<p>因为date函数非常强大，他完全可以胜任一切这样的工作我附个手册里的表吧</p>
<pre class="brush: php;">a - &quot;am&quot; 或是 &quot;pm&quot;
A - &quot;AM&quot; 或是 &quot;PM&quot;
d - 几日，二位数字，若不足二位则前面补零; 如: &quot;01&quot; 至 &quot;31&quot;
D - 星期几，三个英文字母; 如: &quot;Fri&quot;
F - 月份，英文全名; 如: &quot;January&quot;
h - 12 小时制的小时; 如: &quot;01&quot; 至 &quot;12&quot;
H - 24 小时制的小时; 如: &quot;00&quot; 至 &quot;23&quot;
g - 12 小时制的小时，不足二位不补零; 如: &quot;1&quot; 至 12&quot;
G - 24 小时制的小时，不足二位不补零; 如: &quot;0&quot; 至 &quot;23&quot;
i - 分钟; 如: &quot;00&quot; 至 &quot;59&quot;
j - 几日，二位数字，若不足二位不补零; 如: &quot;1&quot; 至 &quot;31&quot;
l - 星期几，英文全名; 如: &quot;Friday&quot;
m - 月份，二位数字，若不足二位则在前面补零; 如: &quot;01&quot; 至 &quot;12&quot;
n - 月份，二位数字，若不足二位则不补零; 如: &quot;1&quot; 至 &quot;12&quot;
M - 月份，三个英文字母; 如: &quot;Jan&quot;
s - 秒; 如: &quot;00&quot; 至 &quot;59&quot;
S - 字尾加英文序数，二个英文字母; 如: &quot;th&quot;，&quot;nd&quot;
t - 指定月份的天数; 如: &quot;28&quot; 至 &quot;31&quot;
U - 总秒数
w - 数字型的星期几，如: &quot;0&quot; (星期日) 至 &quot;6&quot; (星期六)
Y - 年，四位数字; 如: &quot;1999&quot;
y - 年，二位数字; 如: &quot;99&quot;
z - 一年中的第几天; 如: &quot;0&quot; 至 &quot;365&quot;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xuandun.net/66/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>php小偷程序的一些笔记</title>
		<link>http://www.xuandun.net/64/</link>
		<comments>http://www.xuandun.net/64/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 19:16:40 +0000</pubDate>
		<dc:creator>炫盾</dc:creator>
				<category><![CDATA[PHP笔记]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xuandun.net/?p=64</guid>
		<description><![CDATA[最近花3个晚上时间写了一个小偷程序，之所以这么长时间是因为一切都是用php写的，php函数的强大再次让我兴奋....
]]></description>
			<content:encoded><![CDATA[<p>最近花3个晚上时间写了一个小偷程序，之所以这么长时间是因为一切都是用php写的，php函数的强大再次让我兴奋&#8230;.</p>
<p>关于小偷程序获取目标网页的方式很多常见的是fopen，curl。fopen就不必解释了。curl的功能很强大几乎是小偷程序首选。可以登录，甚至发送信息&#8230;.可以搞群发或者帮你更新Twitter等等&#8230;.</p>
<p>我的目标页是utf-8获取数据后需要转换为gb2312，来进行数据处理与存储，google一下发现很多复杂的方法实际上：mb_convert_encoding($data, &#8220;gb2312&#8243;, &#8220;utf-8&#8243;);就可以完美完成！</p>
<p>使用正则表达式提取一下某些数据，preg_match_all最好可以匹配出所以情况并输出数组，自己看看需要的数据在哪，然后提取就行了。</p>
<p>目标页我想要的内容里竟然有非常多的超链接，不可容忍，用正则表达式的方式搞定的话非累死你不可而且效率也不会很高，用：strip_tags($data,&#8221;&lt;div&gt;&lt;p&gt;&lt;span&gt;&lt;img&gt;&lt;strong&gt;&lt;br&gt;&#8221;);在该函数的第一个选项里填上需要保留的html标签，没有填写的比如现在的&lt;a&gt;&lt;ul&gt;&lt;li&gt;等全部会被干掉而且效率超高&#8230;</p>
<p>获取的信息大部分是html代码由于转义问题执行sql的时候会失败：addslashes函数就可以自动为字符串添加转义。</p>
<p>分割目标页的时候explode比较好用 这里提供一个函数也是google来的在情况复杂目标页的情况下很好用</p>
<pre class="brush: php;">function cut($file, $from, $end) {
$message = explode($from, $file);
$message = explode($end, $message[2]);
return $message[0];}</pre>
<p>关于定时功能我想了一个笨办法哈哈，那就是我是需要每小时获取一次新数据的小偷程序，总不能使用计划任务吧以后转到linux平台咋办？每个用户访问都去偷一下 服务器又吃不消。我是这样的先使用data获取H也就是24小时制数字，比如19点执行完一次偷窃后写入现在的小时，以后每个用户访问的时候判断一下sql了存储的小时对比现在的小时如果不相等那就是超过一小时了，执行偷并再次更新时间为当前小时也就相等了下次不执行偷。如果偷取出现错误，我设置了错误处理情况是：不偷，但更新时间为当前然后发信给我提示。这样数据还可以继续被用户查看，又不影响下次执行，也许对方服务器一小时后就已经恢复了 嘎嘎不恢复我们也能挺住很久直到管理员插手处理&#8230;</p>
<p>怎么样有点意思的思路吧？按天按分钟按月按年都可以，但是按N小时等方法这就不适用了</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xuandun.net/64/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>PHP操作符笔记</title>
		<link>http://www.xuandun.net/62/</link>
		<comments>http://www.xuandun.net/62/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 10:10:52 +0000</pubDate>
		<dc:creator>炫盾</dc:creator>
				<category><![CDATA[PHP笔记]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xuandun.net/?p=62</guid>
		<description><![CDATA[<p>直接复制来的，只是用来方便查询</p>
]]></description>
			<content:encoded><![CDATA[<p>直接复制来的，只是用来方便查询</p>
<p><strong>运算符（Arithmetic Operators）</strong></p>
<table width="100%" cellspacing="0" border="1" id="table1">
<tbody>
<tr>
<th width="15%" align="left">Operator<br />            符号</th>
<th width="40%" align="left">Description<br />            描述</th>
<th width="25%" align="left">Example<br />            案例</th>
<th width="20%" align="left">Result<br />            结果</th>
</tr>
<tr>
<td valign="top">+</td>
<td valign="top">Addition<br />            加号</td>
<td valign="top">x=2<br />            x+2</td>
<td valign="top">4</td>
</tr>
<tr>
<td valign="top">-</td>
<td valign="top">Subtraction<br />            减号</td>
<td valign="top">x=2<br />            5-x</td>
<td valign="top">3</td>
</tr>
<tr>
<td valign="top">*</td>
<td valign="top">Multiplication<br />            乘号</td>
<td valign="top">x=4<br />            x*5</td>
<td valign="top">20</td>
</tr>
<tr>
<td valign="top">/</td>
<td valign="top">Division<br />            除号</td>
<td valign="top">15/5<br />            5/2</td>
<td valign="top">3<br />            2.5</td>
</tr>
<tr>
<td valign="top">%</td>
<td valign="top">Modulus (division remainder)<br />            求模（余数）</td>
<td valign="top">5%2<br />            10%8<br />            10%2</td>
<td valign="top">1<br />            2<br />            0</td>
</tr>
<tr>
<td valign="top">++</td>
<td valign="top">Increment<br />            自加</td>
<td valign="top">x=5<br />            x++</td>
<td valign="top">x=6</td>
</tr>
<tr>
<td valign="top">&#8211;</td>
<td valign="top">Decrement<br />            自减</td>
<td valign="top">x=5<br />            x&#8211;</td>
<td valign="top">x=4</td>
</tr>
</tbody>
</table>
<p><strong>Assignment Operators<br />分配符（Assignment Operators）</strong></p>
<table width="100%" cellspacing="0" border="1" id="table2">
<tbody>
<tr>
<th width="15%" align="left">Operator<br />            符号</th>
<th width="40%" align="left">Example<br />            案例</th>
<th width="45%" align="left">Is The Same As<br />            等同于</th>
</tr>
<tr>
<td valign="top">=</td>
<td valign="top">x=y</td>
<td valign="top">x=y</td>
</tr>
<tr>
<td valign="top">+=</td>
<td valign="top">x+=y</td>
<td valign="top">x=x+y</td>
</tr>
<tr>
<td valign="top">-=</td>
<td valign="top">x-=y</td>
<td valign="top">x=x-y</td>
</tr>
<tr>
<td valign="top">*=</td>
<td valign="top">x*=y</td>
<td valign="top">x=x*y</td>
</tr>
<tr>
<td valign="top">/=</td>
<td valign="top">x/=y</td>
<td valign="top">x=x/y</td>
</tr>
<tr>
<td valign="top">%=</td>
<td valign="top">x%=y</td>
<td valign="top">x=x%y</td>
</tr>
</tbody>
</table>
<p><strong>Comparison Operators<br />比较符（Comparison Operators）</strong></p>
<table width="100%" cellspacing="0" border="1" id="table3">
<tbody>
<tr>
<th width="15%" align="left">Operator<br />            符号</th>
<th width="40%" align="left">Description<br />            具体描述</th>
<th width="45%" align="left">Example<br />            案例</th>
</tr>
<tr>
<td valign="top">==</td>
<td valign="top">is equal to<br />            等于</td>
<td valign="top">5==8&nbsp;返回 false</td>
</tr>
<tr>
<td valign="top">!=</td>
<td valign="top">is not equal<br />            不等于</td>
<td valign="top">5!=8 返回&nbsp; true</td>
</tr>
<tr>
<td valign="top">&gt;</td>
<td valign="top">is greater than<br />            大于</td>
<td valign="top">5&gt;8 返回&nbsp; false</td>
</tr>
<tr>
<td valign="top">&lt;</td>
<td valign="top">is less than<br />            小于</td>
<td valign="top">5&lt;8 返回&nbsp; true</td>
</tr>
<tr>
<td valign="top">&gt;=</td>
<td valign="top">is greater than or equal to<br />            大于等于</td>
<td valign="top">5&gt;=8 返回&nbsp; false</td>
</tr>
<tr>
<td valign="top">&lt;=</td>
<td valign="top">is less than or equal to<br />            小于等于</td>
<td valign="top">5&lt;=8 返回&nbsp; true</td>
</tr>
</tbody>
</table>
<p><strong>Logical Operators<br />逻辑判断符（Logical Operators）</strong></p>
<table width="100%" cellspacing="0" border="1" id="table4">
<tbody>
<tr>
<th width="15%" align="left">Operator<br />            符号</th>
<th width="40%" align="left">Description<br />            描述</th>
<th width="45%" align="left">Example<br />            案例</th>
</tr>
<tr>
<td valign="top">&amp;&amp;</td>
<td valign="top">and<br />            与</td>
<td valign="top">x=6<br />            y=3
<p>(x &lt; 10 &amp;&amp; y &gt; 1)&nbsp;返回 true</p>
</td>
</tr>
<tr>
<td valign="top">||</td>
<td valign="top">or<br />            或</td>
<td valign="top">x=6<br />            y=3
<p>(x==5 || y==5)&nbsp;返回 false</p>
</td>
</tr>
<tr>
<td valign="top">!</td>
<td valign="top">not<br />            非</td>
<td valign="top">x=6<br />            y=3
<p>!(x==y)返回true</p>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.xuandun.net/62/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php一些替代正则表达式的函数</title>
		<link>http://www.xuandun.net/61/</link>
		<comments>http://www.xuandun.net/61/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 20:33:08 +0000</pubDate>
		<dc:creator>炫盾</dc:creator>
				<category><![CDATA[PHP笔记]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xuandun.net/?p=61</guid>
		<description><![CDATA[嘎嘎，正则表达式真难理解啊，记一些可以替代的函数还是比较容易滴！
]]></description>
			<content:encoded><![CDATA[<p>嘎嘎，正则表达式真难理解啊，记一些可以替代的函数还是比较容易滴！<br />
1.奇怪的strtok函数，可以根据制定参数分解字符串，每一部分相当于一个指针，需要配合循环语句才能完全执行完，注意第一参数只需给一次就ok了！，例如</p>
<pre class="brush: php;">$a=&quot;xuandun同学:鉴于您的良好表现,特颁布本届诺贝尔和平奖|假的啦&quot;;
$c=&quot;|,:&quot;;
$b=strtok($a,$c);
while ($b){
echo &quot;$b&amp;lt;br /&amp;gt;&quot;;
$b=strtok($c);
}</pre>
<p>2.explode函数，分解字符串为数组，这个其实前面学习的时候用到过，上例子：</p>
<pre class="brush: php;">//把1111-11-11 按-分开为数组，并输出该数组
print_r(explode(&quot;-&quot;,&quot;1111-11-11&quot;));</pre>
<p>3.implode函数，终于把1111-11-11这个超级光棍节分开了，晕用它又恢复了，例:</p>
<pre class="brush: php;">//先分开他，变成数组了
$a=explode(&quot;-&quot;,&quot;1111-11-11&quot;);
//该函数可以合并数组，使用第一个参数指定分隔符
echo implode(&quot;/&quot;,$a);</pre>
<p>4.strpos函数搜索指定字符串第一次出现的位置（区分大小写，姊妹：stripos不区分大小写），不常用查手册<br />
5.strrpos函数搜索指定字符串最后一次出现的位置（区分大小写，姊妹：strripos不区分大小写），不常用查手册<br />
6.最频繁用的str_replace函数，替换字符串</p>
<pre class="brush: php;">echo str_replace(&quot;帅哥&quot;,&quot;美女&quot;,&quot;我是帅哥&quot;);</pre>
<p>7.strstr函数可以获取从指定字符串开始后面的字符，比若说提取邮箱的域名部分</p>
<pre class="brush: php;">echo ltrim(strstr(&quot;admin@xuandun.com&quot;,&quot;@&quot;),&quot;@&quot;);
</pre>
<p>因为是输出包括指定函数+后面的字符串，所以需要使用ltrim删除那个指定滴函数，查手册吧。<br />
8.substr函数，指定位置读取字符串，查手册吧，写麻烦<br />
9.统计指定字符串出现次数，substr_count函数<br />
10.替换字符串内指定位置开始重新写为新的内容，substr_replace函数<br />
11.刚才提前登场的ltrim函数，从字符串开始处删除字符，包括空格、换行、回车等等。rtrim函数删除从后面开始，teim函数从2头开始<br />
12.str_pad函数，把字符串填充为指定长度的字符串，可以指定填充物，默认空格，更多参数手册吧<br />
13.count_chars可以计算每个字符的出现频率，不常用 手册吧<br />
14.str_word_count可以返回字符串里的所有单词成数组 不常用 手册吧<br />
写完了 洗洗睡吧</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xuandun.net/61/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php一些字符串函数笔记</title>
		<link>http://www.xuandun.net/60/</link>
		<comments>http://www.xuandun.net/60/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 19:02:36 +0000</pubDate>
		<dc:creator>炫盾</dc:creator>
				<category><![CDATA[PHP笔记]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xuandun.net/?p=60</guid>
		<description><![CDATA[还是记忆一些函数<br/>1.确定字符串长度strlen函数<br/>2.区分大小写比较两个字符串strcmp语句
]]></description>
			<content:encoded><![CDATA[<p>还是记忆一些函数<br/>1.确定字符串长度strlen函数<br/>2.区分大小写比较两个字符串strcmp语句<br/>3.不区分大小写比较两个字符串 strcasecmp语句<br/>4.返回字符串中包含另一字符串中一部分的长度 strspn语句，离职时判断密码不是全由数字组成<br/>5.返回上面情况的不同部分，也可以验证密码用<br/>6.将字符串全部转换为小写strtolower语句<br/>7.转换为大写strtoupper语句<br/>8.降低一个字母转为大写ucfirst语句<br/>9.将每个单词的头一个字母转为大写 ucwords语句<br/>10.将所有换行符转为br的nl2br语句，例如输出txt的时候，换行符在html里没有效用，换成br就好了！<br/>11. 转换危险或需要显示的字符的htmlspecialchars<br/>直接输出<br />的结果当然是变成换行了，如果我们需要他输出显示怎么办呢？如何防止有html标签的恶意提交呢？用它全解决<br/>可以指定3个参数自查手册吧<br/>对于第二个问题strip_tags显然更适合因为他可以删除字符串里的标记<br/>12.更好的将文本转换成html的get_html_translation_table函数，可以为了输出到浏览器做更好的格式化<br/>13.自定义转换清单，strtr函数，第二个函数可以定义一个数组，键为需要转换的符号，值为转换后的符号<br/>可以作为转换文字，注意是区分大小写的<br/>14.strip_tags转换html为纯文本。可以指定第二个函数来保留标记<br/>15.str_replace( 被替换的值，替换的值，被替换的内容)<br/>16.md5</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xuandun.net/60/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php目录与文件信息的操作笔记</title>
		<link>http://www.xuandun.net/56/</link>
		<comments>http://www.xuandun.net/56/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 20:17:25 +0000</pubDate>
		<dc:creator>炫盾</dc:creator>
				<category><![CDATA[PHP笔记]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xuandun.net/?p=56</guid>
		<description><![CDATA[这是被我跳过的部分，回来再写一下吧，反正还有时间，全是函数罢了，唉 真是懒得写，不过要想学好，耐心是必须得！
]]></description>
			<content:encoded><![CDATA[<p>这是被我跳过的部分，回来再写一下吧，反正还有时间，全是函数罢了，唉 真是懒得写，不过要想学好，耐心是必须得！但是&#8230;.偷懒是我的特色&#8230;. 有时候就不举例了<br/>1.获取路径里的文件名basename语句，<br/>
<p class="code"><code>$text&nbsp;=&nbsp;"/www/web/php/beta.php";<br/>echo&nbsp;basename($text),'&lt;br&gt;';<br/>//忽略.php后缀<br/>echo&nbsp;basename($text,".php")</code></p>
<p>2.获取路径里的目录dirname语句，与上面功能正好相反，不举例了<br/>3.一次性获得路径里多个信息pathinfo语句，返回的是数组<br/>
<p class="code"><code>$text&nbsp;=&nbsp;pathinfo("/www/web/php/beta.php");<br/>echo&nbsp;"所在目录：",$text[dirname],'&lt;br&gt;';<br/>echo&nbsp;"文件名：",$text[basename],'&lt;br&gt;';<br/>echo&nbsp;"后缀：",$text[extension];<br/></code></p>
<p>4.确定绝对路径,有的时候地址是有../等相对路径的，我们可以通过realpath获得绝对地址，不举例了<br/>5.获得文件大小,filesize语句,当然了返回是字节<br/>
<p class="code"><code>$text&nbsp;=&nbsp;"beta.php";<br/>echo&nbsp;filesize($text);</code></p>
<p>6.计算所在分区区可用空间disk_free_space语句。返回字节<br/>
<p class="code"><code>$text&nbsp;=&nbsp;"F:\www\PHP";<br/>echo&nbsp;disk_free_space($text);<br/></code></p>
<p>这里注意权限问题！<br/>7.计算中所在分区总容量，disk_total_space语句，用法同上.<br/>8.获取文件最后访问时间fileatime语句，需要date格式化后输出<br/>
<p class="code"><code>$text&nbsp;=&nbsp;"phpinfo.php";<br/>echo&nbsp;date("y-m-d&nbsp;H:i:s",fileatime($text));</code></p>
<p>9.获取文件最后改变时间filectime语句，用法同上<br/>改变不是修改，修改是指修改文件内容了，改变是指比方说权限，或所有人等信息的改变才是这个语句<br/>10.获取文件最后修改时间filemtime语句，用法同上<br/>11.删除目录的rmdir，当然了只是可以删除空目录<br/>
<p class="code"><code>rmdir("a/b");<br/>//删除当前目录下a文件夹里的b文件夹,a\b也ok，也就是相对绝对都ok&nbsp;注意权限</code></p>
<p>12.rename 文件重命名，包括文件夹，不为空的文件夹也可以<br/>
<p class="code"><code>rename("a/b","a/c");<br/>//重命名当前目录下a文件夹里的b文件夹为c,同样相对绝对都ok&nbsp;注意权限</code></p>
<p>13.不常用的touch，可以设置指定文件的修改和访问时间，如果文件不存在就创建它。手册吧<br/>14.删除指定文件unlink函数，只要有权限什么地址都ok<br/>15.创建目录mkdir函数，有四个参数，查手册吧，默认就基本全ok的</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xuandun.net/56/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>php的Perl风格正则表达式笔记</title>
		<link>http://www.xuandun.net/55/</link>
		<comments>http://www.xuandun.net/55/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 08:40:44 +0000</pubDate>
		<dc:creator>炫盾</dc:creator>
				<category><![CDATA[PHP笔记]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.xuandun.net/?p=55</guid>
		<description><![CDATA[又浪费了2天，下面记一下刚看的perl的正则表达式吧
]]></description>
			<content:encoded><![CDATA[<p>又浪费了2天，下面记一下刚看的perl的正则表达式吧<br/>匹配xuandun<br/>/xuandun/<br/>匹配xuandun加后面跟一个或多个字符<br/>/xuandun+/<br/>匹配xuandun加后面2-4个n字符（例如xuandunn xuandunnnn）<br/>/xuandun{2,4}/<br/>1.修饰符<br/>
<p class="code"><code>i&nbsp;完全不区分大小写<br/>g&nbsp;查找所有出现(全局搜索)<br/>m&nbsp;默认的正则开始”^”和结束”$”只是对于正则字符串如果在修饰符中加上”m”，那么开始和结束将会指字符串的每一行：每一行的开头就是”^”，结尾就是”$”。<br/>s&nbsp;将字符串视为一行，忽略其中的换行符，与m正好相反<br/>x&nbsp;忽略空白和注释<br/>u&nbsp;第一匹配后，就停止，不让他们贪婪的尽可能完成匹配</code></p>
<p>这些修饰符应该放在正则表达式后面/xuandun/i 还可以组合使用 /xuandun/gi<br/>2.元字符<br/>
<p class="code"><code>\A&nbsp;只匹配字符串开通<br/>\b&nbsp;匹配单词边界<br/>\B&nbsp;匹配除了边界外的字符<br/>\d&nbsp;匹配数字<br/>\D&nbsp;匹配非数字<br/>\s&nbsp;匹配空白字符<br/>\S&nbsp;匹配非空白字符<br/>[]&nbsp;包围字符类<br/>()&nbsp;包围字符分组<br/>$&nbsp;匹配行尾<br/>^&nbsp;匹配行首<br/>.&nbsp;匹配换行以外的字符<br/>\&nbsp;引用下一个元字符<br/>\w&nbsp;匹配只包含字母数字下划线的字符串<br/>\W&nbsp;匹配没有下划线字母数字的字符串</code></p>
<p>比如，匹配pisa和lisa这样的字符串，不要sand这样的字符串<br/>/sa\b/<br/>匹配xuandun第一次出现,不区分大小写<br/>/\bxuandun\b/i<br/>\B与单词边界字符相反，匹配除单词边界之外任意字符。应该匹配sand sally这样的字符串，而不能匹配melissa<br/>/sa\b/<br/>例如返回满足条件:字符串包含一个美元符号，后面跟一个或多个数字<br/>/\$\d+\g<br/>下面是兼容perl的正则表达式函数<br/>3.搜索字符串preg_grep，例如匹配j开头的名字<br/>
<p class="code"><code>$names=array("tom","jim","andy","jack");<br/>$name=preg_grep("/^j/",$names);<br/>print_r($name);<br/></code></p>
<p>4.preg_match语句，搜索条件存在与否返回布尔值，查手册不举例了<br/>5.preg_match_all 匹配所有出现。第一个参数为正则表达式，二个是字符串，第三个是存储为的数组<br/>
<p class="code"><code>$names="name:&lt;b&gt;andy&lt;/b&gt;&lt;br&gt;&lt;b&gt;tom&lt;/b&gt;";<br/>preg_match_all("/&lt;b&gt;(.*)&lt;\/b&gt;/U",$names,$name);<br/>printf("%s&nbsp;&lt;br&nbsp;/&gt;&nbsp;%s",$name[0][0],$name[0][1]);</code></p>
<p>6.preg_quote对于特殊含义的字符前插入反斜线，以便后续使用，当然也可指定界定符<br/>
<p class="code"><code>$text&nbsp;=&nbsp;"tickets&nbsp;for&nbsp;the&nbsp;bout&nbsp;are&nbsp;going&nbsp;for&nbsp;$500.";<br/>echo&nbsp;preg_quote($text);</code></p>
<p>为美元符号和点都加了反斜杠<br/>7.替换符合条件的所有出现preg_replace语句，与ereg_replace相同,只是前者基于perl表达式罢了，例子不举了 查手册<br/>8.不区分大小写将字符串划分为不同元素preg_split语句，与split基本相同，手册自查<br/>9.创建指定的替换函数preg_replace_callback自查手册吧</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xuandun.net/55/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
