{"id":31875,"date":"2024-11-25T13:21:20","date_gmt":"2024-11-25T05:21:20","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31875\/"},"modified":"2024-11-25T13:21:20","modified_gmt":"2024-11-25T05:21:20","slug":"wordpress%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e8%ae%bf%e5%ae%a2%e7%bb%9f%e8%ae%a1","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31875\/","title":{"rendered":"wordpress\u5982\u4f55\u5b9e\u73b0\u8bbf\u5ba2\u7edf\u8ba1"},"content":{"rendered":"<\/p>\n<p>\u4e0b\u9762\u7531\/&#8221; target=&#8221;_blank&#8221;&gt;<strong>wordpress\u6559\u7a0b<\/strong>\u680f\u76ee\u7ed9\u5927\u5bb6\u4ecb\u7ecdwordpress\u5b9e\u73b0\u8bbf\u5ba2\u7edf\u8ba1\u7684\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u9700\u8981\u7684\u670b\u53cb\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/020\/5feaee89f3e41337.jpg\" class=\"aligncenter\" title=\"wordpress\u5982\u4f55\u5b9e\u73b0\u8bbf\u5ba2\u7edf\u8ba1\u63d2\u56fe\" alt=\"wordpress\u5982\u4f55\u5b9e\u73b0\u8bbf\u5ba2\u7edf\u8ba1\u63d2\u56fe\" \/><\/p>\n<p>\u7a0b\u5e8f\u4fee\u6539<\/p>\n<p>\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\u7528php+mysql\u5b9e\u73b0\u7b80\u5355\u7684\u8bbf\u5ba2\u7edf\u8ba1<\/p>\n<p>\u4e00\u3001php\u811a\u672c<\/p>\n<pre>&lt;?php  \n\/\/\u8fde\u63a5\u6570\u636e\u5e93 \n$conn=mysql_connect(\"localhost\",\"root\",\"root\"); \nif(!$conn){ \ndie(\"\u94fe\u63a5\u5931\u8d25\".mysql_errno()); \n} \n\/\/\u8bbe\u7f6e\u6570\u636e\u5e93\u7f16\u7801\u65b9\u5f0f \nmysql_query(\"set names utf8\",$conn) or die(mysql_errno()); \n\/\/\u9009\u62e9\u6570\u636e\u5e93 \nmysql_select_db(\"wordpress\",$conn) or die(mysql_errno()); \n$adress=$_SERVER[\"REMOTE_ADDR\"]; \n\/\/\u5c06\u672c\u6b21\u8bbf\u5ba2\u7684ip\u5730\u5740\u6dfb\u52a0\u5230\u6570\u636e\u5e93\u4e2d \n$sql=\"select times from wp_count where ip=&#039;$adress&#039;\"; \n$res=mysql_query($sql,$conn); \nif(!$row=mysql_fetch_row($res)){ \n$sql=\"insert into wp_count(ip, times) values(&#039;$adress&#039;,&#039;1&#039;)\"; \n}else{ \n$times = $row[&#039;0&#039;]+1; \n$sql=\"update wp_count set times=&#039;$times&#039; where ip=&#039;$adress&#039;\"; \n} \n$res=mysql_query($sql,$conn);\n\/\/\u53d1\u9001\u8bed\u53e5\u83b7\u53d6\u603b\u6570 \n$sql=\"select count(ip) from wp_count\"; \n$res=mysql_query($sql,$conn); \nif($row=mysql_fetch_row($res)){ \n$num=$row[&#039;0&#039;]; \n} \necho\"\u60a8\u662f\u7b2c \".\"$num\".\" \u4f4d\u8bbf\u5ba2\".\"\u60a8\u7684ip\u5730\u5740\u662f\".\"$adress\"; \nmysql_close(); \n?&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u89e3\u91ca\uff1a\u5f53\u6570\u636e\u5e93\u4e2d\u5f53\u524dip\u6ca1\u6709\u7684\u65f6\u5019\uff0c\u6267\u884cinsert\u3002\u5426\u5219\u6267\u884cupdate\u3002insert\u63d2\u5165ip\u4ee5\u53ca\u521d\u59cb\u503ctimes=1\uff0cupdate\u66f4\u65b0times+1\u3002<\/p>\n<p>\u4e8c\u3001\u6570\u636e\u5e93\u793a\u4f8b<\/p>\n<p>\u8868wp_count <br \/> \u3000\u3000<img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/020\/897e1c3096b76fb13163bea7e469b1fc-1.png\" class=\"aligncenter\" title=\"wordpress\u5982\u4f55\u5b9e\u73b0\u8bbf\u5ba2\u7edf\u8ba1\u63d2\u56fe1\" alt=\"wordpress\u5982\u4f55\u5b9e\u73b0\u8bbf\u5ba2\u7edf\u8ba1\u63d2\u56fe1\" \/><br \/>ps\uff1a\u4e0a\u9762\u7684\u8868\u7ed3\u6784\u6ee1\u8db3\u6211\u7684\u9700\u6c42\uff0c\u56e0\u4e3a\u6211\u7684\u7ad9\u70b9\u7edf\u8ba1\u7684\u662fip\u6570\uff0c\u800c\u4e14\u6211\u5c06\u540c\u4e00\u4e2aip\u65e0\u8bba\u8bbf\u95ee\u591a\u5c11\u6b21\u90fd\u8ba4\u5b9a\u4e3a\u4ed6\u662f\u4e00\u4e2a\u8bbf\u5ba2\u3002\u9875\u9762\u4e0a\u663e\u793a\u7684\u591a\u5c11\u4f4d\u5c31\u662f\u603b\u5171\u6709\u591a\u5c11\u4e2aip\u8bbf\u95ee\u3002<\/p>\n<p>\u4e09\u3001\u6548\u679c <br \/> \u3000\u3000<img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/020\/4a7158ab8e5ec9dc4a969bd42c07d72a-2.png\" class=\"aligncenter\" title=\"wordpress\u5982\u4f55\u5b9e\u73b0\u8bbf\u5ba2\u7edf\u8ba1\u63d2\u56fe2\" alt=\"wordpress\u5982\u4f55\u5b9e\u73b0\u8bbf\u5ba2\u7edf\u8ba1\u63d2\u56fe2\" \/><br \/>\u56db\u3001\u6269\u5c55<\/p>\n<p>\u4e0a\u9762\u7684\u793a\u4f8b\u4f7f\u7528\u7684\u662f\u6570\u636e\u5e93\u7684\u65b9\u5f0f\u5b9e\u73b0\u3002\u5f53\u7136\uff0c\u5982\u679c\u4f7f\u7528txt\u6587\u672c\u7684\u5f62\u5f0f\u4e5f\u662f\u53ef\u4ee5\u7684\u3002<\/p>\n<p>\u5728\u7b80\u5355\u7684\u8bbf\u5ba2\u7edf\u8ba1\u7684\u57fa\u7840\u4e0a\uff0c\u5927\u5bb6\u53ef\u4ee5\u4e3a\u81ea\u5df1\u7684\u7ad9\u70b9\u6dfb\u52a0\u4e00\u4e2a\u5f88\u7cbe\u786e\u7684\u7ad9\u70b9\u7edf\u8ba1\u3002\u4f8b\u5982\u5b9e\u73b0\u8bbf\u5ba2\u4e0a\u6b21\u8bbf\u95ee\u65f6\u95f4\uff0c\u5c31\u53ef\u4ee5\u5229\u7528js\u89e6\u53d1\u5f53\u8bbf\u5ba2\u5173\u95ed\u5f53\u524d\u9875\u9762\u7684\u65f6\u5019\u4fee\u6539\u8bbf\u95ee\u65f6\u95f4\u5c31\u80fd\u5b9e\u73b0\u3002<\/p>\n<p>ps\uff1a\u7ecf\u6d4b\u8bd5\uff0c\u767e\u5ea6\u7edf\u8ba1\u7684\u6570\u636e\u5e76\u4e0d\u662f\u975e\u5e38\u51c6\u786e\u3002\u56e0\u4e3a\u767e\u5ea6\u662f\u7528\u5f15\u7528\u7684js\u8fdb\u884c\u6570\u636e\u7edf\u8ba1\uff0c\u5982\u679c\u7ad9\u70b9js\u52a0\u8f7d\u5931\u8d25\u6216\u8005\u5176\u4ed6\u539f\u56e0\u5c31\u53ef\u80fd\u5bfc\u81f4\u67d0\u4e9b\u6570\u636e\u672a\u7edf\u8ba1\u5230\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5b9e\u73b0\u8bbf\u5ba2\u7edf\u8ba1\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u7531\/&#8221; target=&#8221;_blank&#8221;&gt;wordpress\u6559\u7a0b\u680f\u76ee\u7ed9\u5927\u5bb6\u4ecb\u7ecdwordpress\u5b9e\u73b0\u8bbf\u5ba2\u7edf\u8ba1\u7684\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u9700\u8981\u7684\u670b\u53cb\u6709\u6240\u5e2e\u52a9\uff01 \u7a0b\u5e8f\u4fee\u6539 \u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\u7528php+mysql\u5b9e\u73b0\u7b80\u5355\u7684\u8bbf\u5ba2\u7edf\u8ba1 \u4e00\u3001php\u811a\u672c &lt;?php \/\/\u8fde\u63a5\u6570\u636e\u5e93 $conn=mysql_connect(&#8220;localhost&#8221;,&#8221;root&#8221;,&#8221;root&#8221;); if(!$conn){ die(&#8220;\u94fe\u63a5\u5931\u8d25&#8221;.mysql_errno()); } \/\/\u8bbe\u7f6e\u6570\u636e\u5e93\u7f16\u7801\u65b9\u5f0f mysql_query(&#8220;set names utf8&#8221;,$conn) or die(mysql_errno()); \/\/\u9009\u62e9\u6570\u636e\u5e93 mysql_select_db(&#8220;wordpress&#8221;,$conn) or die(mysql_errno()); $adress=$_SERVER[&#8220;REMOTE_ADDR&#8221;]; \/\/\u5c06\u672c\u6b21\u8bbf\u5ba2\u7684ip\u5730\u5740\u6dfb\u52a0\u5230\u6570\u636e\u5e93\u4e2d $sql=&#8221;select times from wp_count where ip=&#039;$adress&#039;&#8221;; $res=mysql_query($sql,$conn); if(!$row=mysql_fetch_row($res)){ $sql=&#8221;insert into wp_count(ip, times) values(&#039;$adress&#039;,&#039;1&#039;)&#8221;; }else{ $times = $row[&#039;0&#039;]+1; $sql=&#8221;update wp_count set times=&#039;$times&#039; where ip=&#039;$adress&#039;&#8221;; } $res=mysql_query($sql,$conn); \/\/\u53d1\u9001\u8bed\u53e5\u83b7\u53d6\u603b\u6570 $sql=&#8221;select count(ip) from wp_count&#8221;; $res=mysql_query($sql,$conn); if($row=mysql_fetch_row($res)){ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-31875","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=31875"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31875\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}