{"id":157,"date":"2023-02-18T21:14:51","date_gmt":"2023-02-18T13:14:51","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=157"},"modified":"2023-02-18T21:16:51","modified_gmt":"2023-02-18T13:16:51","slug":"php-get-all-mysql-databases","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/18\/php-get-all-mysql-databases\/","title":{"rendered":"PHP\u83b7\u53d6MySQL\u6240\u6709\u6570\u636e\u5e93"},"content":{"rendered":"<p>\u9700\u8981root\u8d26\u6237\u6743\u9650<\/p>\n<p><!-- more --><\/p>\n<pre><code class=\"language-php\">$conn = mysqli_connect(&quot;localhost&quot;, &quot;root&quot;, &quot;123456&quot;) or die(&quot;\u6570\u636e\u5e93\u670d\u52a1\u5668\u8fde\u63a5\u5931\u8d25&quot;);\n$ret = mysqli_query($conn, &quot;SHOW DATABASES&quot;);\n\n\/\/\u904d\u5386\u65b9\u5f0f\u4e00\nwhile ($row = mysqli_fetch_object($ret))\n{\n    echo $row-&gt;Database . &quot;&lt;br&gt;&quot;;\n}\n\n\/\/\u904d\u5386\u65b9\u5f0f\u4e8c\nwhile ($row = mysqli_fetch_assoc($ret))\n{\n    echo $row[&#039;Database&#039;] . &quot;&lt;br&gt;&quot;;\n}\n\nmysqli_close($conn);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u8981root\u8d26\u6237\u6743\u9650 $conn = mysqli_connect(&quot;localhost&quot; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69],"tags":[],"class_list":["post-157","post","type-post","status-publish","format-standard","hentry","category-php-basic"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=157"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/157\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}