<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[zheman's Blog - Php&Mysql]]></title>
<link>http://www.windie.com/blog/</link>
<description><![CDATA[落花有意随流水 流水无心恋落花]]></description>
<language>zh-cn</language>
<copyright><![CDATA[Copyright 2005 PBlog2 v2.4]]></copyright>
<webMaster><![CDATA[zheman@126.com(zheman)]]></webMaster>
<generator>PBlog2 v2.4</generator> 
<image>
	<title>zheman&#39;s Blog</title> 
	<url>http://www.windie.com/blog/images/logos.gif</url> 
	<link>http://www.windie.com/blog/</link> 
	<description>zheman&#39;s Blog</description> 
</image>

			<item>
			<link>http://www.windie.com/blog/default.asp?id=322</link>
			<title><![CDATA[wap知识总结]]></title>
			<author>zheman@126.com(zheman)</author>
			<category><![CDATA[Php&amp;Mysql]]></category>
			<pubDate>Thu,11 Dec 2008 09:19:34 +0800</pubDate>
			<guid>http://www.windie.com/blog/default.asp?id=322</guid>	
		<description><![CDATA[服务器配置：<br/>如果你的电脑,WEB服务器是IIS<br/><br/>IIS－－默认网站属性－－&gt;http 头－－&gt;MIME映射 －－&gt;文件类型 －－&gt;新类型<br/>.wml text/vnd.wap.wml <br/>.wmlc application/vnd.wap.wmlc <br/>.wmls text/vnd.wap.wmlscript <br/>.wmlsc application/vnd.wap.wmlscriptc <br/>.wbmp image/vnd.wap.wbmp <br/><br/>如果你的电脑,WEB服务器是Apache<br/><br/>Apache安装目录下的conf/mime.types文件<br/>增加：<br/>text/vnd.wap.wml .wml<br/>image/vnd.wap.wbmp .wbmp<br/>application/vnd.wap.wmlc .wmlc<br/>text/vnd.wap.wmls .wmls<br/>application/vnd.wap.wmlsc .wmlsc]]></description>
		</item>
		
			<item>
			<link>http://www.windie.com/blog/default.asp?id=254</link>
			<title><![CDATA[表单与PHP的交互]]></title>
			<author>zheman@126.com(zheman)</author>
			<category><![CDATA[Php&amp;Mysql]]></category>
			<pubDate>Fri,30 Nov 2007 15:54:19 +0800</pubDate>
			<guid>http://www.windie.com/blog/default.asp?id=254</guid>	
		<description><![CDATA[<img src="http://www.windie.com/blog/attachments/month_0711/8200711183244.jpg" border="0" alt=""/><br/><br/>说起表单，我们获取信息基本上要全部依靠表单。例如注册邮箱，发表贴子灌水等等。<br/><br/>先来看一个例子：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$action = $_SERVER[&#39;PHP_SELF&#39;];//取得该文件的绝对路径<br/>if ($_SERVER[&#39;REQUEST_METHOD&#39;] == &#39;POST&#39;){//判断表单提交方法是否为POST<br/>&#160;&#160;&#160;&#160;echo &#39;使用了post方法传递表单值:&#39;;<br/>&#160;&#160;&#160;&#160;echo $_POST[&#39;email&#39;];&#160;&#160;&#160;&#160;//利用$_POST输出以POST方法传递过来的表单值，<br/>}<br/>?&gt;<br/>&lt;form name=&#34;regform&#34; id=&#34;regform&#34; action=&#34;&lt;?php echo $action;//输出action变量值?&gt;&#34; method=&#34;post&#34;&gt;<br/>电子邮件:&lt;input type=&#34;text&#34; size=&#34;30&#34; name=&#34;email&#34; value=&#34;&#34;&gt;<br/>&lt;input type=&#34;submit&#34; name=&#34;btnSubmit&#34; value=&#34;确定&#34;&gt;<br/>&lt;/form&gt;<br/></div></div><br/><br/>还有一种传递方式是get方法，比如象本篇文章的地址为：<br/><a href="http://www.windice.com/blog/blogedit.asp?id=254" target="_blank">http://www.windice.com/blog/blogedit.asp?id=254</a><br/>后面的id=254就是利用get传递的，很显然后面的254可以有用户任意修改提交到服务端做处理。<br/>如果程序不严谨的话，很容易出错。get传递方法只能控制在250字符，超过后，浏览器自动截断。<br/><br/>POST方法发送变量数据时，对于用户来说是不透明的，按HTTP协议来说，数据附加于header的头信息中，用户不能随意修改，这对于Web应用程序而言，安全性要好得多，而且使用POST可以发送大体积的数据给Web服务器。 <br/><br/><strong>常用表单：</strong><br/> <br/>input type=&#34;checkbox&#34; <br/> 复选框，允许用户选择多个选择项 <br/> <br/>input type=&#34;file&#34; <br/> 文件浏览框，当文件上传时，可用来打开一个模式窗口以选择文件 <br/> <br/>input type=&#34;hidden&#34; <br/> 隐藏标签，用于在表单中以隐含方式提交变量值 <br/> <br/>input type=&#34;password&#34; <br/> 密码文本框，用户在该文本框输入字符时将被替换显示为 * 号 <br/> <br/>input type=&#34;radio&#34; <br/> 单选项，用于设置一组选择项，用户只能选择一个 <br/> <br/>input type=&#34;reset&#34; <br/> 清除与重置表单内容，用于清除表单中所有文本框的内容，而且使选择菜单项恢复到初始值 <br/> <br/>input type=&#34;submit&#34; <br/> 表单提交按钮 <br/> <br/>input type=&#34;text&#34; <br/> 单行文本框 <br/> <br/>sel&#101;ct <br/> 下拉列表框，可单选和多选。默认为单选，如果增加多项选择功能，增加 &lt;sel&#101;ct name=&#34;sel&#101;ct&#34; size=&#34; 自定义列数 &#34; multiple=&#34;multiple&#34;&gt; 即可 <br/> <br/>option <br/> 列表下拉菜单，和 sel&#101;ct 配合使用，显示供选择的值 <br/> <br/>textarea <br/> 多行文本框，在使用文本框时需要关闭标签之间的文本内容，形成如下格式：<br/> &lt;Textarea&gt; 你的文字 <br/><br/><strong>表单属性：</strong><br/><br/>name <br/> 文本框的名称， PHP 根据该名称，在超级全局数组中建立以 name 为名称的键名 <br/> <br/>size <br/> 文本框的宽度，在 sel&#101;ct 下拉菜单中，表示可以看到的选项行数 <br/> <br/>value <br/> 文本框中的默认值，注意，该值不能应用到 type=password 密码文本框以及 type=file 文件文本框中 <br/> <br/>multiple <br/> 此属性用于下拉列表菜单 sel&#101;ct 中，指定该选项用户可以使用 Ctrl 和 Shift 键进行多选 <br/> <br/>rows <br/> 多行文本框显示时可以容纳的字符列数宽度 <br/> <br/>cols <br/> 多行文本框显示时可以容纳的字符行数高度 <br/><br/><strong>编写动态生成radio的函数</strong><br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>//函数体<br/>function generate_radio_group($name,$options,$default){<br/>&#160;&#160;&#160;&#160;$name = htmlentities($name);<br/>&#160;&#160;&#160;&#160;foreach ($options as $value =&gt; $labls){<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$value = htmlentities($value);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$html .=&#34;&lt;input type=\&#34;radio\&#34; &#34;;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$html .= &#34;name=\&#34;$name\&#34; value=\&#34;$value\&#34; &#34;;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if ($value == $default){<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$html .= &#34;CHECKED&#34;;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$html .=&#34;&gt;&#34;;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$html .=$labls.&#34;&lt;br&gt;&#34;;<br/>&#160;&#160;&#160;&#160;}<br/>&#160;&#160;&#160;&#160;return ($html);&#160;&#160;&#160;&#160;<br/>}<br/>//初始化数据<br/>$options = array(&#39;010&#39;=&gt;&#39;北京&#39;,<br/>&#39;022&#39;=&gt;&#39;天津&#39;,<br/>&#39;024&#39;=&gt;&#39;沈阳&#39;,<br/>&#39;020&#39;=&gt;&#39;上海&#39;,<br/>);<br/>$default = &#39;022&#39;;<br/>//调用函数<br/>$html = generate_radio_group(&#39;city&#39;,$options,$default);<br/>//输出内容<br/>echo $html;<br/>?&gt;<br/></div></div><br/><br/><strong>表单的处理方法</strong><br/><br/>来看几个PHP全局数组：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$action = $_SERVER[&#39;PHP_SELF&#39;];<br/>echo $action.&#34;&lt;br&gt;&#34;;<br/>$name = $_SERVER[&#39;SERVER_NAME&#39;];<br/>echo $name.&#34;&lt;br&gt;&#34;;<br/>$ref = $_SERVER[&#39;HTTP_REFERER&#39;];<br/>echo $ref;<br/>?&gt;<br/></div></div><br/>输出结果：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>/chap5/test.php<br/><a href="http://127.0.0.1/chap5/" target="_blank">http://127.0.0.1/chap5/</a><br/>127.0.0.1<br/></div></div><br/><br/>HTTP_REFERER 保存一个完整的来源URL地址。 <br/>SERVER_NAME 当前的服务器名称。 <br/>PHP_SELF 当前脚本的完整路径，包括文件名。<br/><br/>看一个防止站外提交数据的例子：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$action = $_SERVER[&#39;PHP_SELF&#39;];//当前脚本的完整路径，包括文件名<br/>if ($_SERVER[&#39;REQUEST_METHOD&#39;] == &#39;POST&#39;){//判断表单提交方法<br/>&#160;&#160;&#160;&#160;$ref = $_SERVER[&#39;HTTP_REFERER&#39;];//存一个完整的来源URL地址<br/>&#160;&#160;&#160;&#160;$srv =&#34;<a href="http://" target="_blank">http://</a>{$_SERVER[&#39;SERVER_NAME&#39;]}$action&#34;;//获取服务器名称.$action一个完整的URL<br/>&#160;&#160;&#160;&#160;echo &#34;客户端：$ref&lt;br&gt;服务端:$srv&lt;hr&gt;&#34;;<br/>&#160;&#160;&#160;&#160;<br/>&#160;&#160;&#160;&#160;if (strcmp($ref,$srv == 0))&#160;&#160;&#160;&#160;{//利用strcmp函数判断两者是否相同<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;echo &#34;合法提交&#34;;<br/>&#160;&#160;&#160;&#160;}else{<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;echo &#34;非法提交&#34;;<br/>&#160;&#160;&#160;&#160;}<br/>}else{<br/>&#160;&#160;&#160;&#160;echo &#34;请提交表单！&#34;;<br/>}<br/>?&gt;<br/>&lt;form action=&#34;&lt;?php echo $action;?&gt; &#34; method=&#34;post&#34;&gt;<br/>&lt;input type=&#34;submit&#34; value=&#34;sumbit&#34;&gt;<br/>&lt;/form&gt;<br/></div></div><br/><br/>一个综合的例子：<br/><br/>form.htm<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/html.gif" style="margin:0px 2px -3px 0px"> HTML代码</div><div class="UBBContent"><TEXTAREA rows="8" id="temp79848">
<html>
<head>
<meta http-equiv=&#34;Content-Language&#34; content=&#34;gb2312&#34; />
<meta name=&#34;GENERATOR&#34; content=&#34;Zend Studio&#34; />
<meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=gb2312&#34; />
<title>title</title>
</head>
<body bgcolor=&#34;#FFFFFF&#34; text=&#34;#000000&#34; link=&#34;#FF9966&#34; vlink=&#34;#FF9966&#34; alink=&#34;#FFCC99&#34;>
<form action=&#34;someform.php&#34; method=&#34;post&#34;> 

<table width=&#34;541&#34; border=&#34;0&#34;> 

<tr> 

<td width=&#34;26%&#34;>姓名：</td> 

<td width=&#34;74%&#34;><input type=&#34;text&#34; name=&#34;username&#34; value=&#34;raymond&#34; id=&#34;username&#34; /></td> 

</tr> 

<tr> 

<td>密码：</td> 

<td><input type=&#34;password&#34; name=&#34;password&#34; maxlength=&#34;10&#34; id=&#34;password&#34; /></td> 

</tr> 

<tr> 

<td>年龄：</td> 

<td> 

<sel&#101;ct name=&#34;age&#34;> 

<option value=&#34;>16&#34;>小于16</option> 

<option value=&#34;16-30&#34; sel&#101;cted>16-30</option> 

<option value=&#34;31-50&#34;>31-50</option> 

<option value=&#34;51-80&#34;>51-80</option> 

</sel&#101;ct> 

</td> 

</tr> 

<tr> 

<td valign=&#34;top&#34;>自我介绍:</td> 

<td><textarea name=&#34;intro&#34; rows=&#34;3&#34; cols=&#34;50&#34; id=&#34;intro&#34;>请输入您的自我介绍<&#47textarea></td> 

</tr> 

<tr> 

<td><br /> 

体育爱好： </td> 

<td><input type=&#34;radio&#34; name=&#34;fave_sport&#34; value=&#34;tennis&#34; checked> 

网球 

<input type=&#34;radio&#34; name=&#34;fave_sport&#34; value=&#34;football&#34;> 

足球 

<input type=&#34;radio&#34; name=&#34;fave_sport&#34; value=&#34;baseball&#34;> 

篮球 

<input type=&#34;radio&#34; name=&#34;fave_sport&#34; value=&#34;polo&#34;> 

保龄球 </td> 

</tr> 

<tr> 

<td> 开发语言：</td> 

<td><input name=&#34;from&#34; type=&#34;hidden&#34; id=&#34;from&#34; value=&#34;注册表单&#34;> 

<input type=&#34;checkbox&#34; name=&#34;languages[]&#34; value=&#34;php&#34; checked id=&#34;languages[]&#34;> 

php 

<input type=&#34;checkbox&#34; name=&#34;languages[]&#34; value=&#34;java&#34; id=&#34;languages[]&#34;> 

java 

<input type=&#34;checkbox&#34; name=&#34;languages[]&#34; value=&#34;perl&#34; id=&#34;languages[]&#34;> 

perl 

<input type=&#34;checkbox&#34; name=&#34;languages[]&#34; value=&#34;cpp&#34; id=&#34;languages[]&#34;> 

c++ 

<input type=&#34;checkbox&#34; name=&#34;languages[]&#34; value=&#34;.net&#34; id=&#34;languages[]&#34;> 

.NET 

<input type=&#34;checkbox&#34; name=&#34;languages[]&#34; value=&#34;delphi&#34; id=&#34;languages[]&#34;> 

delphi </td> 

</tr> 

<tr> 

<td valign=&#34;top&#34;><br> 

<label> 开发工具：</label></td> 

<td><sel&#101;ct name=&#34;develop_ide[]&#34; size=&#34;5&#34; multiple id=&#34;develop_ide[]&#34;> 

<option value=&#34;ZDE&#34; sel&#101;cted>Zend Studio</option> 

<option value=&#34;Eclipse&#34;>Eclipse</option> 

<option value=&#34;Editplus&#34;>Editplus</option> 

<option value=&#34;Ultraedit&#34;>Ultraedit</option> 

<option value=&#34;Other&#34;>Other</option> 

</sel&#101;ct></td> 

</tr> 

<tr> 

<td valign=&#34;top&#34;>&amp;nbsp;</td> 

<td><input type=&#34;submit&#34; name=&#34;btn_submit&#34; value=&#34;提交&#34; /></td> 

</tr> 

</table> 

</form> 
</body>
</html>

</TEXTAREA><br/><INPUT onclick="runEx('temp79848')"  type="button" value="运行此代码"/> <INPUT onclick="doCopy('temp79848')"  type="button" value="复制此代码"/><br/> [Ctrl+A 全部选择 提示：你可先修改部分代码，再按运行]</div></div><br/><br/>someform.php<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php <br/><br/>//通过判断按钮的变量名是否在$_POST中定义，如果有表示该表单已提交 <br/>if(isset($_POST[&#34;btn_submit&#34;])){ <br/>if (empty($_POST[&#39;username&#39;])){ <br/>echo &#34;您没有输入用户名&#34;; <br/>exit(0); <br/>} <br/>if (empty($_POST[&#39;password&#39;])){ <br/>echo &#34;您没有输入密码: &#34;; <br/>exit(0); <br/>} <br/>echo &#34;您的用户名： &#34;.$_POST[&#39;user_name&#39;].&#34;&lt;br /&gt;&#34;; <br/>echo &#34;您的密码(明文)： &#34;.$_POST[&#39;password&#39;].&#34;&lt;br /&gt;&#34;; <br/>echo &#34;您的年龄： &#34;.$_POST[&#39;age&#39;].&#34;&lt;br /&gt;&#34;; <br/>if (!empty($_POST[&#39;languages&#39;])){ <br/>echo &#34;您选择的语言为：&#34;; <br/>//处理用户选择兴趣的checkbox按钮产生的数组 <br/>foreach ($_POST[&#39;languages&#39;] as $lang){ <br/>echo $lang. &#34; &amp;nbsp;&#34;; <br/>} <br/>} else { <br/>echo &#34;您没有输入任何兴趣爱好&#34;; <br/>} <br/>if (!empty($_POST[&#39;develop_ide&#39;])){ <br/>echo &#34;您使用的开发工具为：&#34;; <br/>//处理用户多选开发工具菜单产生的数组 <br/>foreach ($_POST[&#39;develop_ide&#39;] as $ide){ <br/>echo $ide. &#34; &amp;nbsp;&#34;; <br/>} <br/>} else { <br/>echo &#34;您没有选择开发工具&#34;; <br/>} <br/>echo &#34;您的自我介绍： &#34;.nl2br($_POST[&#39;intro&#39;]).&#34;&lt;br /&gt;&#34;; <br/>echo &#34;网页隐藏值(通过hidden标签值传递)： &#34;.$_POST[&#39;from&#39;].&#34;&lt;br /&gt;&#34;; <br/>} <br/>?&gt; <br/><br/></div></div><br/><br/><br/><br/><br/><br/><br/> <br/>]]></description>
		</item>
		
			<item>
			<link>http://www.windie.com/blog/default.asp?id=252</link>
			<title><![CDATA[PHP简单留言本]]></title>
			<author>zheman@126.com(zheman)</author>
			<category><![CDATA[Php&amp;Mysql]]></category>
			<pubDate>Thu,29 Nov 2007 14:21:46 +0800</pubDate>
			<guid>http://www.windie.com/blog/default.asp?id=252</guid>	
		<description><![CDATA[<img src="http://www.windie.com/blog/attachments/month_0711/8200711183244.jpg" border="0" alt=""/><br/><br/>说明一下，这个留言本，主要是练习利用PHP写入mysql数据库，并从库中读出记录，没有分页，没有表单验证，没有防止SQL注入，没有防止灌水机制，没有回复，没有删除，没有修改等等管理功能。有的只是写入数据库，读出数据库中记录集。如果您需要现成的留言本拿来就用的话，还是算了，如果您正在PHP的路上，那您可以看看，高手请飞过 <img src="http://www.windie.com/blog/images/smilies/Face_02.gif" border="0" style="margin:0px 0px -2px 0px" alt=""/><br/><br/>数据库及相关表：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>Cr&#101;ate TABLE `message` (<br/>`id` INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,<br/>`name` VARCHAR( 10 ) NOT NULL ,<br/>`comment` TEXT NOT NULL <br/>) ENGINE = MYISAM ;<br/><br/></div></div><br/><br/>PS:mysql数据库不熟悉的请参看我的上篇文章：[url＝<a href="http://www.windice.com/blog/article.asp?id=250" target="_blank">http://www.windice.com/blog/article.asp?id=250</a>]mysql的简单使用说明[/url]<br/><br/>留言本目录下有四个文件：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">Book:<br/>|————conn.php//数据库链接代码<br/>|————write.php//表单页<br/>|————save.php//插入数据库记录<br/>|————show.php//显示数据库记录<br/></div></div><br/><br/>write.php<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;form action=&#34;save.php&#34; method=&#34;post&#34;&gt;<br/>&lt;input type=&#34;text&#34; name=&#34;name&#34; value=&#34;guest&#34;&gt;<br/>&lt;br&gt;<br/>&lt;textarea rows=&#34;5&#34; cols=&#34;17&#34; name=&#34;message&#34;&gt;input message&lt;/textarea&gt;&lt;br&gt;<br/>&lt;input type=&#34;submit&#34; value=&#34;submit&#34;&gt;&amp;nbsp;&amp;nbsp&lt;input type=&#34;reset&#34; value=&#34;reset&#34;&gt;<br/>&lt;/form&gt;<br/></div></div><br/><br/>conn.php<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$host=&#34;localhost&#34;;//主机<br/>&#160;&#160;&#160;&#160;&nbsp;&nbsp;$dbuser=&#34;root&#34;;//mysql用户<br/>&#160;&#160;&#160;&#160;&nbsp;&nbsp;$dbpass=&#34;root&#34;;//mysql密码<br/>&#160;&#160;&#160;&#160;&nbsp;&nbsp;$dbname=&#34;book&#34;;//数据库名称<br/>&#160;&#160;&#160;&#160;&nbsp;&nbsp;$conn=mysql_connect($host,$dbuser,$dbpass) o&#114; die(&#34;数据库连接失败：&#34;.mysql_error());//建立数据库链接<br/>&#160;&#160;&#160;&#160;&nbsp;&nbsp;mysql_sel&#101;ct_db($dbname);//选择数据库<br/>&#160;&#160;&#160;&#160;&nbsp;&nbsp;<br/>?&gt;<br/></div></div><br/><br/>save.asp<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>require(&#34;conn.php&#34;);//把数据库链接引用进来<br/>$name = $_POST[&#34;name&#34;];//获取表单提交过来的数据<br/>$message = $_POST[&#34;message&#34;];<br/>$sql = &#34;ins&#101;rt into message(name,comment) values (&#39;$name&#39;,&#39;$message&#39;)&#34;;//插入记录SQL语句<br/>//echo $sql;<br/>$res = mysql_query($sql,$conn);//执行上页sql指令<br/>if (!$res)//如果$res为正则提示success，否则提示error<br/>{<br/>&#160;&#160;&#160;&#160;echo &#34;error!&#34;;<br/>}<br/>else <br/>{<br/>&#160;&#160;&#160;&#160;echo &#34;success&#34;;<br/>}<br/>?&gt;<br/>&lt;br&gt;<br/>&lt;a href=&#34;show.php&#34;&gt;Message&lt;/a&gt;<br/></div></div><br/><br/>show.php<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>include_once(&#39;conn.php&#39;);//引用数据库链接文件<br/>$sql = &#34;sel&#101;ct * from message&#34;;//查询整个message表的SQL语句<br/>$res = mysql_query($sql,$conn);//执行上页SQL指令<br/>echo &#34;Message:&#34;;<br/>echo &#34;&lt;hr size=5 color=black&gt;&#34;;<br/>while($row = mysql_fetch_row($res))//将sel&#101;ct结果放入$row数据<br/>{<br/>&#160;&#160;&#160;&#160;echo &#39;Numb:&nbsp;&nbsp; &#39;.$row[0].&#39;&lt;br&gt;&#39;;//输出ID号<br/>&#160;&#160;&#160;&#160;echo &#39;name:&nbsp;&nbsp; &#39;.$row[1].&#39;&lt;br&gt;&#39;;//输出姓名<br/>&#160;&#160;&#160;&#160;echo &#39;comm:&nbsp;&nbsp; &#39;.$row[2].&#39;&lt;br&gt;&#39;;//输出内容<br/>&#160;&#160;&#160;&#160;echo &#39;&lt;hr size=1 color=#cccccc&gt;&#39;;<br/>}<br/>?&gt;<br/></div></div><br/><br/>OVER!<br/><br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.windie.com/blog/default.asp?id=250</link>
			<title><![CDATA[mysql的简单使用说明]]></title>
			<author>zheman@126.com(zheman)</author>
			<category><![CDATA[Php&amp;Mysql]]></category>
			<pubDate>Thu,29 Nov 2007 10:56:06 +0800</pubDate>
			<guid>http://www.windie.com/blog/default.asp?id=250</guid>	
		<description><![CDATA[<img src="http://www.windie.com/blog/attachments/month_0711/8200711183244.jpg" border="0" alt=""/><br/><br/>建立mysql数据库，有两种方式：<br/>1.是利用myphpadmin来建议，如果是appserv套件的话，则不需要单独安装，如果是手动搭建PHP环境，需要单独安装，不会？百度一下吧。<br/><br/>打开地址，如我的：<a href="http://127.0.0.1/" target="_blank">http://127.0.0.1/</a>如图：<br/><br/><img src="http://www.windie.com/blog/attachments/month_0711/i20071129101915.jpg" border="0" alt=""/><br/><br/>单击这个链接“phpMyAdmin Database Manager Version 2.9.2”输出你的mysql用户名及密码，如我的用户名和密码都为root，确定进入myphpadmin主界面，如下图：<br/><br/><img src="http://www.windie.com/blog/attachments/month_0711/l20071129102123.jpg" border="0" alt=""/><br/><br/>在上图中“整理”上面的输入框中输入需要建立的数据库名称“book”，点击“创建”按钮，如下图<br/><br/><img src="http://www.windie.com/blog/attachments/month_0711/k20071129102637.jpg" border="0" alt=""/><br/><br/>并输入如上数据，点击“执行”按钮，如下图，并输入其数据：<br/><br/><img src="http://www.windie.com/blog/attachments/month_0711/c2007112910296.jpg" border="0" alt=""/><br/><br/><img src="http://www.windie.com/blog/attachments/month_0711/a20071129102957.jpg" border="0" alt=""/><br/><br/>点击“保存”，如下图：<br/><br/><img src="http://www.windie.com/blog/attachments/month_0711/c2007112910386.jpg" border="0" alt=""/><br/><br/>这样，我们就建立了一个名字为“book”的数据库，库中有一个名字为“message”的表，表中有三个字段分别为id,name,comment，其中id为自动编号，并且是主键。<br/><br/>2.利用mysql commend命令提示符下建立：<br/><br/>运行mysql commend，如下图：<br/><br/><img src="http://www.windie.com/blog/attachments/month_0711/020071129104324.jpg" border="0" alt=""/><br/><br/>输出mysql密码，我的是：root，回车如图：<br/><br/><img src="http://www.windie.com/blog/attachments/month_0711/t2007112910451.jpg" border="0" alt=""/><br/><br/>几常用的命令：<br/><br/>show databases;//显示所有数据库<br/>use 数据库名称;//切换到该数据库下<br/>show table from database;//显示从database数据库中table表<br/>cr&#101;ate database;//建立数据库<br/>Cr&#101;ate TABLE `message` (<br/>`id` INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,<br/>`name` VARCHAR( 10 ) NOT NULL ,<br/>`comment` TEXT NOT NULL <br/>) ENGINE = MYISAM ;//这个表就是我们通过myphpadmin来建立表message的信息。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.windie.com/blog/default.asp?id=247</link>
			<title><![CDATA[PHP中的流程控制]]></title>
			<author>zheman@126.com(zheman)</author>
			<category><![CDATA[Php&amp;Mysql]]></category>
			<pubDate>Wed,21 Nov 2007 09:34:53 +0800</pubDate>
			<guid>http://www.windie.com/blog/default.asp?id=247</guid>	
		<description><![CDATA[<img src="http://www.windie.com/blog/attachments/month_0711/8200711183244.jpg" border="0" alt=""/><br/><br/>1.if和if...else及if..else..elseif<br/><br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$a=2;<br/>$b=1;<br/>if ($a &gt; $b)//如果条件为TRUE则输出a is bigger than b<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;a is bigger than b&#34;;<br/>?&gt; <br/></div></div><br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$a=2;<br/>$b=1;<br/>if ($a &gt; $b) {//如果条件为TRUE则输出a is bigger than b<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;a is bigger than b&#34;;<br/>} else {//否则输出下面语句<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;a is NOT bigger than b&#34;;<br/>}<br/>?&gt; <br/></div></div><br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$a=2;<br/>$b=1;<br/>if ($a &gt; $b) {//如果条件为TRUE则输出a is bigger than b<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;a is bigger than b&#34;;<br/>} elseif ($a == $b) {//如果条件为TRUE则输出a is equal to b<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;a is equal to b&#34;;<br/>} else {//都不成立则输出如下语句<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;a is smaller than b&#34;;<br/>}<br/>?&gt; <br/></div></div><br/><br/>*注意，在ASP中需要以End if结尾，而PHP不用。<br/>*流程控制的替代语法:PHP 提供了一些流程控制的替代语法，包括 if，while，for，foreach 和 switch。替代语法的基本形式是把左花括号（{）换成冒号（:），把右花括号（}）分别换成 endif;，endwhile;，endfor;，endforeach; 以及 endswitch;。 <br/><br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php if ($a == 5): ?&gt;<br/>A is equal to 5<br/>&lt;?php endif; ?&gt; <br/></div></div><br/><br/>不建议如上写法，个人认为代码可读性太差。<br/><br/><br/>2.while与do...while<br/><br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$i = 1;<br/>while ($i &lt;= 10) {<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo $i++;&nbsp;&nbsp;//while循环输出12345678910<br/>}<br/>?&gt; <br/></div></div><br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$i = 1;<br/>do {<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo $i++;&nbsp;&nbsp; //do...while循环输出12345678910<br/>}while($i &lt;= 10)//注意没有分号<br/>?&gt; <br/></div></div><br/><br/>*while循环是先判断再执行，而do...while则是先执行而判断。<br/><br/>3.for与foreach<br/><br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>/*<br/>$i=1为初始化变量<br/>$i&lt;11是判断条件<br/>$i++为运算表达式<br/>*/<br/>for ($i = 1; $i &lt;11; $i++) {<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo $i;//输出12345678910 <br/>}<br/>?&gt; <br/></div></div><br/><br/>foreach只能针对数组操作。<br/><br/>有用的几个函数：<br/>reset() :将 array 的内部指针倒回到第一个单元并返回第一个数组单元的值，如果数组为空则返回 FALSE。 <br/>each() : 返回数组中当前的键／值对并将数组指针向前移动一步 <br/><br/><br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$arr = array(&#34;one&#34;, &#34;two&#34;, &#34;three&#34;);<br/>reset($arr);<br/>while (list(, $value) = each($arr)) {<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;Value: $value&lt;br&gt;\n&#34;;<br/>}<br/>?&gt; <br/></div></div><br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$foo = array(&#34;bob&#34;, &#34;fred&#34;, &#34;jussi&#34;, &#34;jouni&#34;, &#34;egon&#34;, &#34;marliese&#34;);<br/>$bar = each($foo);<br/>print_r($bar);<br/>?&gt; <br/></div></div><br/><br/><br/>foreach示例：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$arr = array(&#34;one&#34;, &#34;two&#34;, &#34;three&#34;);<br/>reset($arr);<br/>foreach ($arr as $value) {<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;Value: $value&lt;br /&gt;\n&#34;;<br/>}<br/>?&gt; <br/></div></div><br/><br/>4.break与continue<br/><br/>break:退出当前循环体，适用范围：for，foreach，while，do-while 或者 switch 结构的执行。<br/>contiune:跳过当前循环进入下一次循环<br/><br/>5.switch<br/><br/>switch 语句和具有同样表达式的一系列的 IF 语句相似。很多场合下需要把同一个变量（或表达式）与很多不同的值比较，并根据它等于哪个值来执行不同的代码。这正是 switch 语句的用途。<br/><br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$i=&#39;bar&#39;;<br/>switch ($i) {<br/>case &#34;apple&#34;:<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;i is apple&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;break;//break的应用<br/>case &#34;bar&#34;:<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;i is bar&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;break;<br/>case &#34;cake&#34;:<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;i is cake&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;break;<br/>}<br/>?&gt; <br/></div></div><br/><br/>6.return<br/><br/>如果在一个函数中调用 return() 语句，将立即结束此函数的执行并将它的参数作为函数的值返回。return() 也会终止 eval() 语句或者脚本文件的执行。 <br/><br/>如果在全局范围中调用，则当前脚本文件中止运行。如果当前脚本文件是被 include() 的或者 require() 的，则控制交回调用文件。此外，如果当前脚本是被 include() 的，则 return() 的值会被当作 include() 调用的返回值。如果在主脚本文件中调用 return()，则脚本中止运行。如果当前脚本文件是在 php.ini 中的配置选项 auto_prepend_file 或者 auto_append_file 所指定的，则此脚本文件中止运行。 <br/><br/>7.包含相关<br/>require()和include() ：句包含并运行指定文件。<br/><br/>require() 和 include() 除了怎样处理失败之外在各方面都完全一样。include() 产生一个警告而 require() 则导致一个致命错误。换句话说，如果想在丢失文件时停止处理页面，那就别犹豫了，用 require() 吧。include() 就不是这样，脚本会继续运行。<br/><br/>require_once() 语句在脚本执行期间包含并运行指定文件。此行为和 require() 语句类似，唯一区别是如果该文件中的代码已经被包含了，则不会再次包含。有关此语句怎样工作参见 require() 的文档。 <br/><br/>include_once() 语句在脚本执行期间包含并运行指定文件。此行为和 include() 语句类似，唯一区别是如果该文件中的代码已经被包含了，则不会再次包含。如同此语句名字暗示的那样，只会包含一次。 <br/><br/><br/><br/><br/><br/><br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.windie.com/blog/default.asp?id=246</link>
			<title><![CDATA[PHP中的运算符]]></title>
			<author>zheman@126.com(zheman)</author>
			<category><![CDATA[Php&amp;Mysql]]></category>
			<pubDate>Mon,19 Nov 2007 13:53:16 +0800</pubDate>
			<guid>http://www.windie.com/blog/default.asp?id=246</guid>	
		<description><![CDATA[<img src="http://www.windie.com/blog/attachments/month_0711/8200711183244.jpg" border="0" alt=""/><br/><br/>任何一种的语言运算符我几乎都记不住，知道个大概就差不多了，不行就查手册。实在分不清也可以加括号。<br/><br/>1.优先级列表<br/><img src="http://www.windie.com/blog/attachments/month_0711/d20071119135515.jpg" border="0" alt=""/><br/><br/>2.算术运算符<br/><img src="http://www.windie.com/blog/attachments/month_0711/l2007111916469.jpg" border="0" alt=""/><br/><br/>3.赋值运算符<br/>基本的赋值运算符是“=”。一开始可能会以为它是“等于”，其实不是的。它实际上意味着把右边表达式的值赋给左边的运算数。 <br/><br/>4.位运算符<br/><img src="http://www.windie.com/blog/attachments/month_0711/g20071119164717.jpg" border="0" alt=""/><br/><br/>5.比较运算符<br/><img src="http://www.windie.com/blog/attachments/month_0711/c2007111916485.jpg" border="0" alt=""/><br/><br/>6.错误控制运算符<br/>PHP 支持一个错误控制运算符：@。当将其放置在一个 PHP 表达式之前，该表达式可能产生的任何错误信息都被忽略掉。<br/><br/>7.执行运算符<br/>PHP 支持一个执行运算符：反引号（``）。注意这不是单引号！PHP 将尝试将反引号中的内容作为外壳命令来执行，并将其输出信息返回（例如，可以赋给一个变量而不是简单地丢弃到标准输出）。<br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$output = `ls -al`;<br/>echo &#34;&lt;pre&gt;$output&lt;/pre&gt;&#34;;<br/>?&gt; <br/></div></div><br/><br/>注意: 反引号运算符在激活了安全模式或者关闭了 shell_exec() 时是无效的。 <br/><br/>8.递增／递减运算符<br/><img src="http://www.windie.com/blog/attachments/month_0711/h2007111916521.jpg" border="0" alt=""/><br/><br/>9.逻辑运算符<br/><img src="http://www.windie.com/blog/attachments/month_0711/y20071119165238.jpg" border="0" alt=""/><br/><br/>10.字符串运算符<br/>有两个字符串运算符。第一个是连接运算符（“.”），它返回其左右参数连接后的字符串。第二个是连接赋值运算符（“.=”），它将右边参数附加到左边的参数后。<br/><br/>11.数组运算符<br/><img src="http://www.windie.com/blog/attachments/month_0711/12007111916549.jpg" border="0" alt=""/><br/>+ 运算符把右边的数组附加到左边的数组后面，但是重复的键值不会被覆盖。 <br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$a = array(&#34;a&#34; =&gt; &#34;apple&#34;, &#34;b&#34; =&gt; &#34;banana&#34;);<br/>$b = array(&#34;a&#34; =&gt; &#34;pear&#34;, &#34;b&#34; =&gt; &#34;strawberry&#34;, &#34;c&#34; =&gt; &#34;cherry&#34;);<br/><br/>$c = $a + $b; // Union of $a and $b<br/>echo &#34;Union of \$a and \$b: \n&#34;;<br/>var_dump($c);<br/><br/>$c = $b + $a; // Union of $b and $a<br/>echo &#34;Union of \$b and \$a: \n&#34;;<br/>var_dump($c);<br/>?&gt; <br/></div></div><br/><br/>结果：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>Union of $a and $b:<br/>array(3) {<br/>&nbsp;&nbsp;[&#34;a&#34;]=&gt;<br/>&nbsp;&nbsp;string(5) &#34;apple&#34;<br/>&nbsp;&nbsp;[&#34;b&#34;]=&gt;<br/>&nbsp;&nbsp;string(6) &#34;banana&#34;<br/>&nbsp;&nbsp;[&#34;c&#34;]=&gt;<br/>&nbsp;&nbsp;string(6) &#34;cherry&#34;<br/>}<br/>Union of $b and $a:<br/>array(3) {<br/>&nbsp;&nbsp;[&#34;a&#34;]=&gt;<br/>&nbsp;&nbsp;string(4) &#34;pear&#34;<br/>&nbsp;&nbsp;[&#34;b&#34;]=&gt;<br/>&nbsp;&nbsp;string(10) &#34;strawberry&#34;<br/>&nbsp;&nbsp;[&#34;c&#34;]=&gt;<br/>&nbsp;&nbsp;string(6) &#34;cherry&#34;<br/>} <br/></div></div><br/><br/>12.类型运算符<br/>PHP 只有一个类型运算符：instanceof 用来测定一个给定的对象，它的父对象或它们所实现的接口是否来自指定的对象类。 <br/><br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>class A { }<br/>class B { }<br/><br/>$thing = new A;<br/><br/>if ($thing instanceof A) {<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#39;A&#39;;<br/>}<br/>if ($thing instanceof B) {<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#39;B&#39;;<br/>}<br/>?&gt; <br/></div></div><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.windie.com/blog/default.asp?id=245</link>
			<title><![CDATA[简明项目实施与部署]]></title>
			<author>zheman@126.com(zheman)</author>
			<category><![CDATA[Php&amp;Mysql]]></category>
			<pubDate>Fri,16 Nov 2007 08:30:51 +0800</pubDate>
			<guid>http://www.windie.com/blog/default.asp?id=245</guid>	
		<description><![CDATA[1。需求分析 -- 用户到底需要什么样的功能，特性，界面，期限。。。画出USER CASE。。。<br/>2。系统分析 -- 用什么系统，框架，模块可以完成上述要求，那些可以用现成的模块，那些必须重新开发。。。画出系统流程图。。。<br/>3。系统设计 -- 怎么实现上述系统，每个模块怎么开发，用什么函数，数据交换怎么做。。。画出类图，ERD。。。<br/>4。系统贯彻 -- 按照计划部署，一一实施。。。<br/>5。系统测试 -- 测试方案。。。<br/>6。系统部署 -- 时间，人员，设备。。。<br/>7。用户培训 -- 手册，方法。。。<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.windie.com/blog/default.asp?id=243</link>
			<title><![CDATA[PHP中的常量]]></title>
			<author>zheman@126.com(zheman)</author>
			<category><![CDATA[Php&amp;Mysql]]></category>
			<pubDate>Mon,12 Nov 2007 17:00:54 +0800</pubDate>
			<guid>http://www.windie.com/blog/default.asp?id=243</guid>	
		<description><![CDATA[<img src="http://www.windie.com/blog/attachments/month_0711/8200711183244.jpg" border="0" alt=""/><br/><br/>1.常量的定义<br/>常量是一个简单值的标识符（名字）。如同其名称所暗示的，在脚本执行期间该值不能改变（除了所谓的魔术常量，它们其实不是常量）。常量默认为大小写敏感。按照惯例常量标识符总是大写的。 <br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>define(&#34;FOO&#34;,&#34;something&#34;);//用关键字define来声明<br/>?&gt; <br/></div></div><br/><br/>适用数据类型：boolean，integer，float ，string 。<br/><br/>2.常量与变量的区别<br/><br/>&lt;1&gt;常量前面没有美元符号（$）； <br/>&lt;2&gt;常量只能用 define() 函数定义，而不能通过赋值语句； <br/>&lt;3&gt;常量可以不用理会变量范围的规则而在任何地方定义和访问；<br/>&lt;4&gt;常量一旦定义就不能被重新定义或者取消定义； <br/>&lt;5&gt;常量的值只能是标量。<br/><br/>3.有常量有关的几个函数<br/><br/>&lt;1&gt;constant() 读取常量的量<br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>define(&#34;MAXSIZE&#34;, 100);<br/>echo constant(&#34;MAXSIZE&#34;); <br/>?&gt; <br/></div></div><br/>&lt;2&gt;get_defined_constants() 输出所有已定义的常量列表<br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>define(&#34;MY_CONSTANT&#34;, 1);<br/>print_r(get_defined_constants(true));<br/>?&gt; <br/></div></div><br/>&lt;3&gt;defined() 检查是否定义了某常量<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>if (defined(&#39;CONSTANT&#39;)) {//如果CONSTANT已经定义则输出CONSTANT<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo CONSTANT;<br/>}<br/>?&gt; <br/></div></div><br/><br/><br/><br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.windie.com/blog/default.asp?id=242</link>
			<title><![CDATA[PHP中的变量]]></title>
			<author>zheman@126.com(zheman)</author>
			<category><![CDATA[Php&amp;Mysql]]></category>
			<pubDate>Mon,12 Nov 2007 14:39:39 +0800</pubDate>
			<guid>http://www.windie.com/blog/default.asp?id=242</guid>	
		<description><![CDATA[<img src="http://www.windie.com/blog/attachments/month_0711/8200711183244.jpg" border="0" alt=""/><br/><br/>1.声明<br/>以$符号声明变量，后面是变量名，就以字母开头，或英文或拼音命名，肯定没错，错误的方法多的是，记个对的就行了<br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$var = &#39;Bob&#39;;//声明变量<br/>echo &#34;$Var&#34;; //输出变量的值<br/>?<br/>&gt;<br/></div></div><br/>2.可变变量<br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$a = &#39;hello&#39;;//声明变量a并赋值为&#34;hello&#34;<br/>$$a = &#39;world&#39;;//声明变量$$a(即$hello)并赋值为&#34;world&#34;<br/>echo &#34;$a ${$a}&#34;;<br/>echo &#34;$a $hello&#34;;<br/>?&gt; <br/></div></div><br/><br/>3.变量作用域<br/>变量作用域即声明一个变量，这个变量有效范围。<br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$a = 1; <br/>function Test(){<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo $a; <br/>}<br/>Test();<br/>?&gt; <br/></div></div><br/><br/>以上程序不会输出任何结果，因为在函数Test()中$a=1的无效。<br/>改成这样就ok了。<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/><br/>function Test(){<br/>&nbsp;&nbsp;&nbsp;&nbsp;$a = 1; //把$a的作用范围放到函数体中，当函数运行完毕后，$a变量也随即删除<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo $a; <br/>}<br/>Test();<br/>?&gt; <br/></div></div><br/>或者<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$a = 1; <br/>function Test(){<br/>&#160;&#160;&#160;&#160;global $a;//把$a利用global声明为全局变量<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo $a; <br/>}<br/>Test();<br/>?&gt; <br/></div></div><br/><br/>static关键字的应用：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>function Test()<br/>{<br/>&nbsp;&nbsp;&nbsp;&nbsp;$a = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo $a;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$a++;<br/>}<br/>Test();<br/>?&gt; <br/></div></div><br/><br/>以上函数基本没有用处，每次调用结果都为0，$a++根本就没有作用，$a的变量作用域就在函数体内，调用<br/>完函数后就又归0了。<br/>改成如下：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/quote.gif" style="margin:0px 2px -3px 0px" alt="引用内容"/> 引用内容</div><div class="UBBContent"><br/>&lt;?php<br/>function Test()<br/>{<br/>&nbsp;&nbsp;&nbsp;&nbsp;static $a = 0;//static的用法<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo $a;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$a++;<br/>}<br/>Test();<br/>Test();<br/>Test();<br/>Test();<br/>?&gt; <br/></div></div><br/><br/>输出结果为:0123<br/><br/><br/><br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.windie.com/blog/default.asp?id=238</link>
			<title><![CDATA[PHP变量类型（二）]]></title>
			<author>zheman@126.com(zheman)</author>
			<category><![CDATA[Php&amp;Mysql]]></category>
			<pubDate>Tue,06 Nov 2007 10:31:17 +0800</pubDate>
			<guid>http://www.windie.com/blog/default.asp?id=238</guid>	
		<description><![CDATA[<img src="http://www.windie.com/blog/attachments/month_0711/8200711183244.jpg" border="0" alt=""/><br/><br/>如果您不了解变量的类型请先看， <a target="_blank" href="http://www.windie.com/blog/article.asp?id=236">《PHP变量类型（一）》</a><br/>(4)string（字符串）<br/><br/>字符串定义分为三种方式：单引号 、双引号 、定界符 。<br/><br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>//单引号定义字符串<br/>$a = &#39;aaa&#39;;<br/>//双引号定义字符串<br/>$b = &#34;bbb&#34;;<br/>//定界符定义字符串<br/>$c = &lt;&lt;&lt;eof<br/>ccccccccc<br/>eof;//顶到头开始写，前面不能留空格<br/>echo $a;<br/>echo &#34;&lt;br&gt;&#34;;<br/>echo $b;<br/>echo &#34;&lt;br&gt;&#34;;<br/>echo $c;<br/>?&gt;<br/></div></div><br/><br/>变量解析：<br/>单引号：如果定义内容中包括变量，直接输出变量名称，而不是内容。<br/>双引号：如果定义内容中包括变量，直接输出内容。<br/>定界符：如果定义内容中包括变量，直接输出内容。<br/><br/>在双引号和定界符中，可以用{}指定变量范围。<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$temps = &#34;123&#34;;<br/>$tempss = &#34;1234&#34;;<br/>$b = &#34;bbb{$temps}s&#34;;<br/>echo $b;<br/>?&gt;<br/></div></div><br/><br/>(5)array()（数组）<br/>定义：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>array( [key =&gt;]<br/>value<br/>&nbsp;&nbsp;&nbsp;&nbsp; , ...<br/>&nbsp;&nbsp;&nbsp;&nbsp; )<br/>// key 可以是 integer 或者 string<br/>// value 可以是任何值<br/></div></div><br/><br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$arr = array(&#34;foo&#34; =&gt; &#34;bar&#34;, 12 =&gt; true);<br/>echo $arr[&#34;foo&#34;]; // bar<br/>echo $arr[12];&nbsp;&nbsp;&nbsp;&nbsp;// 1<br/>?&gt; <br/></div></div><br/><br/>(6)object（对象）<br/>要初始化一个对象，用 new 语句将对象实例到一个变量中。 <br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>//创建一个foo的类<br/>class foo<br/>{<br/>&#160;&#160;&#160;&#160;//创建一个do_foo的方法<br/>&nbsp;&nbsp;&nbsp;&nbsp;function do_foo()<br/>&nbsp;&nbsp;&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;//输出Dong Foo<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;Doing foo.&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>}<br/>//创建一个$bar的实例<br/>$bar = new foo;<br/>//$bar的实例调用do_foo的方法<br/>$bar-&gt;do_foo();<br/>?&gt; <br/></div></div><br/><br/><br/>(7)resource（资源）<br/><br/>待写。。。<br/><br/>(8)NULL<br/><br/>特殊的 NULL 值表示一个变量没有值，而并不是变量不存在。NULL 类型唯一可能的值就是 NULL。 ‘<br/><br/>在下列情况下一个变量被认为是 NULL： <br/><br/>被赋值为 NULL。<br/>尚未被赋值。 <br/>被 unset()。 <br/><br/>例如：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.windie.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/>$var = NULL;<br/>?&gt; <br/></div></div><br/><br/>两个有关的函数：<br/><br/>is_null()：判断变量是否为NUll<br/>unset()：删除变量声明 <br/><br/><br/>变量类型除了资源，其它的基本上都介绍了，如果您是PHP学习者，还是看手册吧，这里只是本人学习记个笔记而已，没有手册全面，细致。<br/><br/><br/><br/>]]></description>
		</item>
		
</channel>
</rss>