{"id":66,"date":"2013-12-03T03:01:59","date_gmt":"2013-12-02T19:01:59","guid":{"rendered":"http:\/\/www.yptk.cn\/index.php\/2013\/12\/03\/%e5%8d%81%e5%a4%a9%e5%ad%a6%e4%bc%9aphp%e4%b9%8b%e7%ac%ac%e5%9b%9b%e5%a4%a9\/"},"modified":"2013-12-03T03:01:59","modified_gmt":"2013-12-02T19:01:59","slug":"%e5%8d%81%e5%a4%a9%e5%ad%a6%e4%bc%9aphp%e4%b9%8b%e7%ac%ac%e5%9b%9b%e5%a4%a9","status":"publish","type":"post","link":"http:\/\/yptk.cn\/index.php\/2013\/12\/03\/%e5%8d%81%e5%a4%a9%e5%ad%a6%e4%bc%9aphp%e4%b9%8b%e7%ac%ac%e5%9b%9b%e5%a4%a9\/","title":{"rendered":"\u5341\u5929\u5b66\u4f1aphp\u4e4b\u7b2c\u56db\u5929"},"content":{"rendered":"<p><span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">\u5b66\u4e60\u76ee\u7684\uff1a\u5b66\u4f1a\u8fde\u63a5\u6570\u636e\u5e93<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; PHP\u7b80\u76f4\u5c31\u662f\u4e00\u4e2a\u51fd\u6570\u5e93\uff0c\u4e30\u5bcc\u7684\u51fd\u6570\u4f7fPHP\u7684\u67d0\u4e9b\u5730\u65b9\u76f8\u5f53\u7b80\u5355\u3002\u5efa\u8bae\u5927\u5bb6down\u4e00\u672cPHP\u7684\u51fd\u6570\u624b\u518c\uff0c\u603b\u7528\u7684\u5230\u3002<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u6211\u8fd9\u91cc\u5c31\u7b80\u5355\u8bf4\u4e00\u4e0b\u8fde\u63a5MYSQL\u6570\u636e\u5e93\u3002<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; 1\u3001mysql_connect<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u6253\u5f00 MySQL \u670d\u52a1\u5668\u8fde\u63a5\u3002&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u8bed\u6cd5: int mysql_connect(string [hostname] [:port], string [username], string [password]); \u8fd4\u56de\u503c: \u6574\u6570&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u672c\u51fd\u6570\u5efa\u7acb\u4e0e MySQL \u670d\u52a1\u5668\u7684\u8fde\u63a5\u3002\u5176\u4e2d\u6240\u6709\u7684\u53c2\u6570\u90fd\u53ef\u7701\u7565\u3002\u5f53\u4f7f\u7528\u672c\u51fd\u6570\u5374\u4e0d\u52a0\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u53c2\u6570 hostname \u7684\u9ed8\u8ba4\u503c\u4e3a localhost\u3001\u53c2\u6570 username \u7684\u9ed8\u8ba4\u503c\u4e3a PHP \u6267\u884c\u884c\u7a0b\u7684\u62e5\u6709\u8005\u3001\u53c2\u6570 password \u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32 (\u5373\u6ca1\u6709\u5bc6\u7801)\u3002\u800c\u53c2\u6570 hostname \u540e\u9762\u53ef\u4ee5\u52a0\u5192\u53f7\u4e0e\u7aef\u53e3\u53f7\uff0c\u4ee3\u8868\u4f7f\u7528\u54ea\u4e2a\u7aef\u53e3\u4e0e MySQL \u8fde\u63a5\u3002\u5f53\u7136\u5728\u4f7f\u7528\u6570\u636e\u5e93\u65f6\uff0c\u65e9\u70b9\u4f7f\u7528 mysql_close() \u5c06\u8fde\u63a5\u5173\u6389\u53ef\u4ee5\u8282\u7701\u8d44\u6e90\u3002&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; 2\u3001 mysql_select_db&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u9009\u62e9\u4e00\u4e2a\u6570\u636e\u5e93\u3002&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u8bed\u6cd5: int mysql_select_db(string database_name, int [link_identifier]); \u8fd4\u56de\u503c: \u6574\u6570<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u672c\u51fd\u6570\u9009\u62e9 MySQL \u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\u4ee5\u4f9b\u4e4b\u540e\u7684\u8d44\u6599\u67e5\u8be2\u4f5c\u4e1a (query) \u5904\u7406\u3002\u6210\u529f\u8fd4\u56de true\uff0c\u5931\u8d25\u5219\u8fd4\u56de false\u3002&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u6700\u7b80\u5355\u7684\u4f8b\u5b50\u5c31\u662f\uff1a<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; $conn=mysql_connect (&#8220;127.0.0.1&#8221;, &#8220;&#8221;, &#8220;&#8221;);<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; mysql_select_db(&#8220;shop&#8221;);<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u8fde\u63a5\u673aMY SQL\u6570\u636e\u5e93\uff0c\u6253\u5f00SHOP\u6570\u636e\u5e93\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u5e94\u5f53\u52a0\u5f3a\u70b9\u9519\u8bef\u5224\u65ad\u3002<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u4eca\u5929\u5c31\u8bf4\u5230\u8fd9\u91cc\uff0c\u660e\u5929\u518d\u8bf4\u4e00\u4e0b\u6570\u636e\u5e93\u7684\u8bfb\u53d6\u3002<\/span><\/p>\n<p style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\">\n\t&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b66\u4e60\u76ee\u7684\uff1a\u5b66\u4f1a\u8fde\u63a5\u6570\u636e\u5e93 &nbsp; PHP\u7b80\u76f4\u5c31\u662f\u4e00\u4e2a\u51fd\u6570\u5e93\uff0c\u4e30\u5bcc\u7684\u51fd\u6570\u4f7fPHP\u7684\u67d0\u4e9b\u5730\u65b9\u76f8\u5f53\u7b80\u5355\u3002\u5efa\u8bae\u5927\u5bb6down\u4e00\u672cPHP\u7684\u51fd\u6570\u624b\u518c\uff0c\u603b\u7528\u7684\u5230\u3002 &nbsp; \u6211\u8fd9\u91cc\u5c31\u7b80\u5355\u8bf4\u4e00\u4e0b\u8fde\u63a5MYSQL\u6570\u636e\u5e93\u3002 &nbsp; 1\u3001mysql_connect &nbsp; \u6253\u5f00 MySQL \u670d\u52a1\u5668\u8fde\u63a5\u3002&nbsp; &nbsp; \u8bed\u6cd5: int mysql_connect(string [hostna [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[15],"tags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-15"],"_links":{"self":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":0,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"wp:attachment":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/tags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}