{"id":433669,"date":"2024-12-17T13:55:25","date_gmt":"2024-12-17T05:55:25","guid":{"rendered":"https:\/\/www.idc.net\/help\/433669\/"},"modified":"2024-12-17T13:55:26","modified_gmt":"2024-12-17T05:55:26","slug":"php%e7%a9%ba%e9%97%b4%e6%97%a0%e9%99%90%e6%95%b0%e6%8d%ae%e5%ba%93%ef%bc%8c%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%bc%81%e4%b8%9a%e7%ab%99%e7%82%b9","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/433669\/","title":{"rendered":"php\u7a7a\u95f4\u65e0\u9650\u6570\u636e\u5e93\uff0c\u5feb\u901f\u642d\u5efa\u4f01\u4e1a\u7ad9\u70b9"},"content":{"rendered":"<h1 id=\"php%e7%a9%ba%e9%97%b4%e6%97%a0%e9%99%90%e6%95%b0%e6%8d%ae%e5%ba%93%ef%bc%8c%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%bc%81%e4%b8%9a%e7%ab%99%e7%82%b9-YGHtgykUwH\">PHP\u7a7a\u95f4\u65e0\u9650\u6570\u636e\u5e93\uff0c\u5feb\u901f\u642d\u5efa\u4f01\u4e1a\u7ad9\u70b9<\/h1>\n<p>\u5728\u5f53\u4eca\u6570\u5b57\u5316\u65f6\u4ee3\uff0c\u4f01\u4e1a\u7f51\u7ad9\u7684\u642d\u5efa\u5df2\u6210\u4e3a\u4f01\u4e1a\u5c55\u793a\u5f62\u8c61\u3001\u63a8\u5e7f\u4ea7\u54c1\u548c\u670d\u52a1\u7684\u91cd\u8981\u9014\u5f84\u3002\u968f\u7740\u6280\u672f\u7684\u4e0d\u65ad\u53d1\u5c55\uff0cPHP\u4f5c\u4e3a\u4e00\u79cd\u6d41\u884c\u7684\u670d\u52a1\u5668\u7aef\u811a\u672c\u8bed\u8a00\uff0c\u56e0\u5176\u7075\u6d3b\u6027\u548c\u6613\u7528\u6027\uff0c\u6210\u4e3a\u4e86\u8bb8\u591a\u4f01\u4e1a\u7f51\u7ad9\u5f00\u53d1\u7684\u9996\u9009\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5982\u4f55\u5229\u7528PHP\u7a7a\u95f4\u548c\u65e0\u9650\u6570\u636e\u5e93\uff0c\u5feb\u901f\u642d\u5efa\u4f01\u4e1a\u7ad9\u70b9\u3002<\/p>\n<h2 id=\"php%e7%9a%84%e4%bc%98%e5%8a%bf-YGHtgykUwH\">PHP\u7684\u4f18\u52bf<\/h2>\n<p>PHP\u662f\u4e00\u79cd\u5f00\u6e90\u7684\u811a\u672c\u8bed\u8a00\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8eWeb\u5f00\u53d1\u3002\u5176\u4e3b\u8981\u4f18\u52bf\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u6613\u4e8e\u5b66\u4e60\uff1a<\/strong>PHP\u7684\u8bed\u6cd5\u76f8\u5bf9\u7b80\u5355\uff0c\u9002\u5408\u521d\u5b66\u8005\u5feb\u901f\u4e0a\u624b\u3002<\/li>\n<li><strong>\u8de8\u5e73\u53f0\u652f\u6301\uff1a<\/strong>PHP\u53ef\u4ee5\u5728\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c\uff0c\u5305\u62ecWindows\u3001Linux\u548cmacOS\u3002<\/li>\n<li><strong>\u4e30\u5bcc\u7684\u793e\u533a\u652f\u6301\uff1a<\/strong>PHP\u62e5\u6709\u5e9e\u5927\u7684\u5f00\u53d1\u8005\u793e\u533a\uff0c\u63d0\u4f9b\u4e86\u5927\u91cf\u7684\u6587\u6863\u548c\u8d44\u6e90\u3002<\/li>\n<li><strong>\u5f3a\u5927\u7684\u6570\u636e\u5e93\u652f\u6301\uff1a<\/strong>PHP\u4e0e\u591a\u79cd\u6570\u636e\u5e93\u7cfb\u7edf\u517c\u5bb9\uff0c\u5c24\u5176\u662fMySQL\uff0c\u9002\u5408\u5904\u7406\u5927\u91cf\u6570\u636e\u3002<\/li>\n<\/ul>\n<h2 id=\"%e6%97%a0%e9%99%90%e6%95%b0%e6%8d%ae%e5%ba%93%e7%9a%84%e6%a6%82%e5%bf%b5-YGHtgykUwH\">\u65e0\u9650\u6570\u636e\u5e93\u7684\u6982\u5ff5<\/h2>\n<p>\u5728\u9009\u62e9PHP\u7a7a\u95f4\u65f6\uff0c\u8bb8\u591a\u4f01\u4e1a\u4f1a\u5173\u6ce8\u6570\u636e\u5e93\u7684\u9650\u5236\u3002\u65e0\u9650\u6570\u636e\u5e93\u610f\u5473\u7740\u7528\u6237\u53ef\u4ee5\u6839\u636e\u9700\u8981\u521b\u5efa\u591a\u4e2a\u6570\u636e\u5e93\uff0c\u800c\u4e0d\u5fc5\u62c5\u5fc3\u7a7a\u95f4\u4e0d\u8db3\u7684\u95ee\u9898\u3002\u8fd9\u5bf9\u4e8e\u9700\u8981\u5904\u7406\u5927\u91cf\u6570\u636e\u7684\u4f01\u4e1a\u5c24\u4e3a\u91cd\u8981\u3002\u4f8b\u5982\uff0c\u7535\u5546\u7f51\u7ad9\u3001\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf\uff08CMS\uff09\u548c\u5ba2\u6237\u5173\u7cfb\u7ba1\u7406\uff08CRM\uff09\u7cfb\u7edf\u7b49\uff0c\u90fd\u53ef\u80fd\u9700\u8981\u591a\u4e2a\u6570\u636e\u5e93\u6765\u5b58\u50a8\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u636e\u3002<\/p>\n<h2 id=\"%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%bc%81%e4%b8%9a%e7%ab%99%e7%82%b9%e7%9a%84%e6%ad%a5%e9%aa%a4-YGHtgykUwH\">\u5feb\u901f\u642d\u5efa\u4f01\u4e1a\u7ad9\u70b9\u7684\u6b65\u9aa4<\/h2>\n<p>\u4ee5\u4e0b\u662f\u5229\u7528PHP\u7a7a\u95f4\u548c\u65e0\u9650\u6570\u636e\u5e93\u5feb\u901f\u642d\u5efa\u4f01\u4e1a\u7ad9\u70b9\u7684\u57fa\u672c\u6b65\u9aa4\uff1a<\/p>\n<h3 id=\"1-%e9%80%89%e6%8b%a9%e5%90%88%e9%80%82%e7%9a%84%e4%b8%bb%e6%9c%ba%e6%9c%8d%e5%8a%a1-YGHtgykUwH\">1. \u9009\u62e9\u5408\u9002\u7684\u4e3b\u673a\u670d\u52a1<\/h3>\n<p>\u9009\u62e9\u4e00\u4e2a\u652f\u6301PHP\u548c\u65e0\u9650\u6570\u636e\u5e93\u7684\u4e3b\u673a\u670d\u52a1\u662f\u7b2c\u4e00\u6b65\u3002\u540e\u6d6a\u4e91\u63d0\u4f9b\u7684\u9999\u6e2f\u548c\u7f8e\u56fd\u670d\u52a1\u5668\uff0c\u80fd\u591f\u6ee1\u8db3\u4f01\u4e1a\u5bf9\u6027\u80fd\u548c\u7a33\u5b9a\u6027\u7684\u9700\u6c42\u3002<\/p>\n<h3 id=\"2-%e5%ae%89%e8%a3%85php%e7%8e%af%e5%a2%83-YGHtgykUwH\">2. \u5b89\u88c5PHP\u73af\u5883<\/h3>\n<p>\u5927\u591a\u6570\u4e3b\u673a\u670d\u52a1\u63d0\u4f9b\u5546\u4f1a\u9884\u88c5PHP\u73af\u5883\uff0c\u4f46\u5982\u679c\u9700\u8981\u624b\u52a8\u5b89\u88c5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a<\/p>\n<pre><code>sudo apt-get update\nsudo apt-get install php libapache2-mod-php php-mysql\n<\/code><\/pre>\n<h3 id=\"3-%e5%88%9b%e5%bb%ba%e6%95%b0%e6%8d%ae%e5%ba%93-YGHtgykUwH\">3. \u521b\u5efa\u6570\u636e\u5e93<\/h3>\n<p>\u4f7f\u7528\u65e0\u9650\u6570\u636e\u5e93\u7684\u4f18\u52bf\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0bMySQL\u547d\u4ee4\u521b\u5efa\u65b0\u7684\u6570\u636e\u5e93\uff1a<\/p>\n<pre><code>CREATE DATABASE my_database;\n<\/code><\/pre>\n<h3 id=\"4-%e5%bc%80%e5%8f%91%e7%bd%91%e7%ab%99%e5%ba%94%e7%94%a8-YGHtgykUwH\">4. \u5f00\u53d1\u7f51\u7ad9\u5e94\u7528<\/h3>\n<p>\u4f7f\u7528PHP\u7f16\u5199\u7f51\u7ad9\u5e94\u7528\u7a0b\u5e8f\uff0c\u8fde\u63a5\u6570\u636e\u5e93\u5e76\u5b9e\u73b0\u6240\u9700\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u4ee3\u7801\u5c55\u793a\u4e86\u5982\u4f55\u8fde\u63a5\u5230MySQL\u6570\u636e\u5e93\uff1a<\/p>\n<pre><code>&lt;?php\n$servername = \"localhost\";\n$username = \"username\";\n$password = \"password\";\n$dbname = \"my_database\";\n\n\/\/ \u521b\u5efa\u8fde\u63a5\n$conn = new mysqli($servername, $username, $password, $dbname);\n\n\/\/ \u68c0\u6d4b\u8fde\u63a5\nif ($conn-&gt;connect_error) {\n    die(\"\u8fde\u63a5\u5931\u8d25: \" . $conn-&gt;connect_error);\n}\necho \"\u8fde\u63a5\u6210\u529f\";\n?&gt;\n<\/code><\/pre>\n<h3 id=\"5-%e9%83%a8%e7%bd%b2%e7%bd%91%e7%ab%99-YGHtgykUwH\">5. \u90e8\u7f72\u7f51\u7ad9<\/h3>\n<p>\u5b8c\u6210\u5f00\u53d1\u540e\uff0c\u5c06\u7f51\u7ad9\u6587\u4ef6\u4e0a\u4f20\u5230\u4e3b\u673a\u670d\u52a1\u5668\u4e0a\uff0c\u5e76\u786e\u4fdd\u914d\u7f6e\u6587\u4ef6\u6b63\u786e\u6307\u5411\u6570\u636e\u5e93\u3002\u53ef\u4ee5\u4f7f\u7528FTP\u5de5\u5177\u5982FileZilla\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u3002<\/p>\n<h2 id=\"%e6%80%bb%e7%bb%93-YGHtgykUwH\">\u603b\u7ed3<\/h2>\n<p>\u901a\u8fc7\u5229\u7528PHP\u7a7a\u95f4\u548c\u65e0\u9650\u6570\u636e\u5e93\uff0c\u4f01\u4e1a\u53ef\u4ee5\u5feb\u901f\u642d\u5efa\u529f\u80fd\u5f3a\u5927\u7684\u7f51\u7ad9\uff0c\u6ee1\u8db3\u65e5\u76ca\u589e\u957f\u7684\u4e1a\u52a1\u9700\u6c42\u3002\u9009\u62e9\u5408\u9002\u7684\u4e3b\u673a\u670d\u52a1\u81f3\u5173\u91cd\u8981\uff0c\u540e\u6d6a\u4e91\u63d0\u4f9b\u7684<a href=\"https:\/\/idc.net\">\u4e91\u670d\u52a1\u5668<\/a>\u548c<a href=\"https:\/\/idc.net\">VPS<\/a>\u89e3\u51b3\u65b9\u6848\uff0c\u80fd\u591f\u4e3a\u4f01\u4e1a\u63d0\u4f9b\u7a33\u5b9a\u7684\u652f\u6301\u3002\u65e0\u8bba\u662f\u9999\u6e2f\u8fd8\u662f\u7f8e\u56fd\u7684\u670d\u52a1\u5668\uff0c\u540e\u6d6a\u4e91\u90fd\u80fd\u6ee1\u8db3\u60a8\u7684\u9700\u6c42\uff0c\u52a9\u529b\u4f01\u4e1a\u5feb\u901f\u53d1\u5c55\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5feb\u901f\u642d\u5efa\u4f01\u4e1a\u7ad9\u70b9\uff0c\u4eab\u53d7PHP\u7a7a\u95f4\u65e0\u9650\u6570\u636e\u5e93\uff0c\u52a9\u529b\u60a8\u7684\u5728\u7ebf\u4e1a\u52a1\u53d1\u5c55\uff0c\u8f7b\u677e\u7ba1\u7406\u6570\u636e\u4e0e\u5185\u5bb9\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[202759],"tags":[],"class_list":["post-433669","post","type-post","status-publish","format-standard","hentry","category-webhosting"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/433669","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=433669"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/433669\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=433669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=433669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=433669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}