{"id":2305,"date":"2023-10-11T14:35:52","date_gmt":"2023-10-11T06:35:52","guid":{"rendered":"https:\/\/white-night.club\/?p=2305"},"modified":"2023-11-09T11:07:50","modified_gmt":"2023-11-09T03:07:50","slug":"pg5","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/11\/pg5\/","title":{"rendered":"PHP\u8fde\u63a5\u81f3Mysql\u7684\u524d\u7f6e\u51c6\u5907"},"content":{"rendered":"\n<p>\u8fd8\u662f\u8981\u53bbphp.ini\u91cc\u4fee\u6539\u914d\u7f6e\u3002<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>mysqli\u9ed8\u8ba4\u4e0d\u542f\u7528<\/p>\n<cite><em>\u9700\u8981\u624b\u52a8\u5220\u6ce8\u91ca<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u5982\u679c\u4f60\u5728\u6ca1\u4fee\u6539\u4efb\u4f55\u914d\u7f6e\u7684\u60c5\u51b5\u4e0b\uff0c\u5c1d\u8bd5\u8fde\u63a5\u672c\u5730\u7684mysql\u6570\u636e\u5e93<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n$servername = \"localhost\";\n$username = \"root\";\n$password = \"123\";\n \n$conn = new mysqli($servername, $username, $password);\n\nif ($conn-&gt;connect_error) {\n    die(\"\u8fde\u63a5\u5931\u8d25: \" . $conn-&gt;connect_error);\n} \necho \"\u8fde\u63a5\u6210\u529f\";\n?&gt;<\/code><\/pre>\n\n\n\n<p>\u5927\u6982\u7387\u662f\u4f1a\u8fd0\u884c\u5931\u8d25\u7684\uff0c\u7f51\u9875\u4e0a\u4e5f\u4f1a\u663e\u793a\u62a5\u9519\u4fe1\u606f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Fatal error: Uncaught Error: Class \"mysqli\" not found in C:\\Users\\LENOVO\\Desktop\\template\\test.php:7 Stack trace: #0 {main} thrown in C:\\Users\\LENOVO\\Desktop\\template\\test.php on line 7<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u62a5\u9519\u4fe1\u606f\u8bf4\u7684\u662f\u6ca1\u627e\u5230\u201cmysqli\u201d\u3002\u5982\u679c\u4f60\u7528\u7684\u662f\u6bd4\u8f83\u65b0\u7684\u7248\u672c\u7684php\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u5728php\u7684ext\u6587\u4ef6\u5939\u4e2d\u627e\u5230<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">php_mysqli.dll<\/mark>\u8fd9\u4e2a\u6587\u4ef6\uff0c\u6ca1\u6709\u7684\u8bdd\u5c31\u8981\u81ea\u5df1\u4e0b\u8f7d\u4e86\u3002<\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765\u8fd8\u9700\u8981\u5728php.ini\u4e2d\u542f\u7528extension\u3002\u4fee\u6539\u8fd9\u4e24\u884c\u4ee3\u7801\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n;extension=imap\n;extension=mbstring\n;extension=exif      ; Must be after mbstring as it depends on it\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffdf00\" class=\"has-inline-color\">extension=mysqli<\/mark>\n;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client\n;extension=oci8_19  ; Use with Oracle Database 19 Instant Client\n;extension=odbc\n;extension=openssl\n...<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n; Directory in which the loadable extensions (modules) reside.\n; https:\/\/php.net\/extension-dir\n;extension_dir = \".\/\"\n; On windows:\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffdf00\" class=\"has-inline-color\">extension_dir = \"F:\/php\/ext\"<\/mark>\n...<\/code><\/pre>\n\n\n\n<p>\u518d\u8fd0\u884c\u5f00\u5934\u7684\u4ee3\u7801\uff0c\u5c31\u80fd\u8fde\u63a5\u5230mysql\u6570\u636e\u5e93\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>php.in\u7684\u914d\u7f6e<\/p>\n","protected":false},"author":1,"featured_media":3838,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[79,33],"tags":[87],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2305"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=2305"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2305\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/3838"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=2305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=2305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=2305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}