{"id":110,"date":"2008-11-12T10:24:24","date_gmt":"2008-11-12T10:24:24","guid":{"rendered":"http:\/\/tw.newtonstudio.com\/?p=110"},"modified":"2008-11-12T10:24:24","modified_gmt":"2008-11-12T10:24:24","slug":"%e5%90%8c%e4%b8%80%e9%a0%81%e9%9d%a2%e4%bd%bf%e7%94%a8%e5%85%a9%e5%80%8b%e8%b3%87%e6%96%99%e5%ba%ab%e7%9a%84%e5%b8%b8%e8%a6%8b%e5%95%8f%e9%a1%8c","status":"publish","type":"post","link":"http:\/\/tw.newtonstudio.com\/?p=110","title":{"rendered":"\u540c\u4e00\u9801\u9762\u4f7f\u7528\u5169\u500b\u8cc7\u6599\u5eab\u7684\u5e38\u898b\u554f\u984c"},"content":{"rendered":"<p>\u6709\u6642\u5019\u6211\u5011\u6703\u5728\u540c\u4e00\u500b\u9801\u9762\u540c\u6642\u4f7f\u7528\u5169\u500b\u8cc7\u6599\u5eab,<\/p>\n<p>\u82e5\u9023\u7dda\u5b57\u4e32\u662f\u653e\u5728CLASS\u7684CONSTRUCTOR\u88e1\u9762, \u901a\u5e38\u6211\u5011\u90fd\u53ea\u8981NEW \u4e00\u6b21, \u5c31\u53ef\u4ee5\u4e00\u76f4\u4fdd\u6301\u8cc7\u6599\u5eab\u9023\u7dda,<\/p>\n<p>\u4f46\u82e5\u5169\u500b\u8cc7\u6599\u5eab\u4ea4\u66ff\u4f7f\u7528, \u5247\u6703\u767c\u751f\u9023\u7dda\u5b57\u4e32\u6df7\u4e82\u7684\u72c0\u6cc1.<\/p>\n<p>\u6b64\u6642\u61c9\u8a72\u5728CLASS\u88e1\u9762\u6bcf\u500bFUNCTION\u90fd\u7684MYSQL_QUERY\u4e4b\u524d\u90fd\u6307\u5b9a\u9023\u7dda\u5b57\u4e32,<\/p>\n<p>\u9019\u6a23\u5c31\u53ef\u4ee5\u4fdd\u6301\u4e00MYSQL_QUERY\u5c0d\u61c9\u4e00\u500b\u8cc7\u6599\u5eab\u7684\u72c0\u6cc1\u4e86.<\/p>\n<blockquote><p>class sample {<\/p>\n<p>function DATABASE() {<br \/>\ninclude(&#8220;db1.php&#8221;);<\/p>\n<p>}<\/p>\n<p>function FIRSTCONNECT() {<br \/>\n$this-&gt;DATABASE();<br \/>\nmysql_query(&#8220;&#8230;..&#8221;);<br \/>\n}<\/p>\n<p>}<\/p>\n<p>class sample2 {<\/p>\n<p>function DATABASE2() {<br \/>\ninclude(&#8220;db2.php&#8221;);<\/p>\n<p>}<\/p>\n<p>function ANOTHERCONNECT() {<br \/>\n$this-&gt;DATABASE2();<br \/>\nmysql_query(&#8220;&#8230;..&#8221;);<br \/>\n}<\/p>\n<p>}<\/p>\n<p>$firstclass = new sample;<\/p>\n<p>$secondclass = new sample2;<\/p>\n<p>$secondclass-&gt;ANOTHERCONNECT(); \/\/\u8b80\u53d6\u81eaDB2 \u7684\u8cc7\u6599\u5eab<\/p>\n<p>$firstclass-&gt;FIRSTCONNECT(); \/\/\u8b80\u53d6\u81eaDB1 \u7684\u8cc7\u6599\u5eab<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u6642\u5019\u6211\u5011\u6703\u5728\u540c\u4e00\u500b\u9801\u9762\u540c\u6642\u4f7f\u7528\u5169\u500b\u8cc7\u6599\u5eab, \u82e5\u9023\u7dda\u5b57\u4e32\u662f\u653e\u5728CLASS\u7684CONSTRUCTOR\u88e1\u9762, \u901a\u5e38\u6211 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-110","post","type-post","status-publish","format-standard","hentry","category-php-"],"_links":{"self":[{"href":"http:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/posts\/110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/tw.newtonstudio.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=110"}],"version-history":[{"count":1,"href":"http:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/posts\/110\/revisions"}],"predecessor-version":[{"id":111,"href":"http:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/posts\/110\/revisions\/111"}],"wp:attachment":[{"href":"http:\/\/tw.newtonstudio.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tw.newtonstudio.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tw.newtonstudio.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}