<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[[个人原创]PHP的构造函数和同类名函数同时申明时调用的情况。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Mon, 30 Jan 2012 09:33:08 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	PHP的构造方法的格式如下：<br/>function __construct()&#123;&#125;<br/>或者：function 类名()&#123;&#125;<br/>－－－<br/>有人喜欢不用构造，而是申明一个同名的函数，这样就可以调用其同名函数，而自动在初始化类时就会调用，而也有喜欢用构造函数的，但是同时出现有什么现象呢，发现是构造函数调用了，但是同类名函数没有被调用。如下：<br/><textarea name="code" class="html" rows="15" cols="100">
&lt;?php
class Verify&#123;

&nbsp;&nbsp;&nbsp;&nbsp;function Verify( $processid )
&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;verify class auto run test.processid=&quot;.$processid.&quot;&#92;n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;new Verify(&quot;911&quot;);

?&gt;
</textarea><br/>root@116.255.139.240:/home/admin/php# php class.php<br/>verify class auto run test.processid=911<br/><br/><br/>而加入function __construct()后，如下：<br/><textarea name="code" class="html" rows="15" cols="100">
&lt;?php
class Verify&#123;

&nbsp;&nbsp;&nbsp;&nbsp;function Verify( $processid )
&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;verify class auto run test.processid=&quot;.$processid.&quot;&#92;n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;function __construct()
&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;auto run function.&#92;n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;new Verify(&quot;911&quot;);

?&gt;
</textarea><br/>root@116.255.139.240:/home/admin/php# php class.php<br/>auto run function.<br/><br/>可以参考：http://blog.k-sya.com/2011/09/20/13.html<br/>类的学习：<br/>http://wenku.baidu.com/view/58f351360b4c2e3f572763e8.html<br/>参考题目：<br/>http://wenku.baidu.com/view/e0e18b7d1711cc7931b716fe.html
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#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://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>