<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[刘新修]]></title> 
<link>http://pic1.liuxinxiu.com:80/index.php</link> 
<description><![CDATA[刘新修的个人博客 (Liuxinxiu'S Blog)]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[刘新修]]></copyright>
<item>
<link>http://pic1.liuxinxiu.com:80/php_class/</link>
<title><![CDATA[实例化php类的时候如何传参]]></title> 
<author>刘新修 &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP/Java/Go]]></category>
<pubDate>Thu, 18 May 2017 09:55:14 +0000</pubDate> 
<guid>http://pic1.liuxinxiu.com:80/php_class/</guid> 
<description>
<![CDATA[ 
	<p>&nbsp;<span style="color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　当我们实例化一个php类的时候，要怎么传递参数呢？这取决于该类的构造方法。</span></p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　例：</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　person.class.php</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　class person&#123;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　var $name;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　var $color;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　var $sex;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　var $age;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　function __construct（$name,$age='',$sex='boy'）&#123;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　$this-&gt;name = $name;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　$this-&gt;age = $age;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　$this-&gt;sex = $sex;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　$this-&gt;color = 'yello';</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　&#125;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　function eat（）&#123;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　echo $this-&gt;name.'要吃饭';</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　&#125;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　function xinxi（）&#123;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　echo $this-&gt;name.' is '.$this-&gt;sex.' and age is '.$this-&gt;age.' fuse is '.$this-&gt;color;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　&#125;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　&#125;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　?&gt;</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　son.php</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　include（'person.class.php'）；</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　$son = new person（'cuihua',25,'girl'）；//此处的参数传递要和类的构造方法里面的参数顺序对应</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　//$son-&gt;xinxi（）；//cuihua is girl and age is 25 fuse is yello</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　$son-&gt;name = '田妞';</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　$son-&gt;eat（）；//田妞要吃饭</p><p style="margin-top: 15px; margin-bottom: 0px; word-break: break-all; color: rgb(51, 51, 51); font-family: &quot;Microsoft Yahei&quot;; font-size: 16px; text-align: justify;">　　?&gt;</p>
]]>
</description>
</item><item>
<link>http://pic1.liuxinxiu.com:80/php_class/#blogcomment</link>
<title><![CDATA[[评论] 实例化php类的时候如何传参]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://pic1.liuxinxiu.com:80/php_class/#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>