{"id":47824,"date":"2024-12-02T11:35:56","date_gmt":"2024-12-02T03:35:56","guid":{"rendered":"https:\/\/fwq.ai\/blog\/47824\/"},"modified":"2024-12-02T11:35:56","modified_gmt":"2024-12-02T03:35:56","slug":"php-%e5%87%bd%e6%95%b0%e6%9c%89%e5%93%aa%e4%ba%9b%e5%b8%b8%e8%a7%81%e5%88%86%e7%b1%bb%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/47824\/","title":{"rendered":"PHP \u51fd\u6570\u6709\u54ea\u4e9b\u5e38\u89c1\u5206\u7c7b\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>PHP \u51fd\u6570\u6709\u54ea\u4e9b\u5e38\u89c1\u5206\u7c7b\uff1f<\/h1>\n<p>\u4eca\u65e5\u4e0d\u80af\u57cb\u5934\uff0c\u660e\u65e5\u4f55\u4ee5\u62ac\u5934\uff01\u6bcf\u65e5\u4e00\u53e5\u52aa\u529b\u81ea\u5df1\u7684\u8bdd\u54c8\u54c8~\u54c8\u55bd\uff0c\u4eca\u5929\u6211\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aPHP \u51fd\u6570\u6709\u54ea\u4e9b\u5e38\u89c1\u5206\u7c7b\uff1f\u300b<\/span>\uff0c\u4e3b\u8981\u5185\u5bb9\u662f\u8bb2\u89e3<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u53ef\u4ee5\u6536\u85cf\u6216\u8005\u6709\u66f4\u597d\u7684\u5efa\u8bae\u5728\u8bc4\u8bba\u63d0\u51fa\uff0c\u6211\u90fd\u4f1a\u8ba4\u771f\u770b\u7684\uff01\u5927\u5bb6\u4e00\u8d77\u8fdb\u6b65\uff0c\u4e00\u8d77\u5b66\u4e60\uff01<\/p>\n<p>PHP \u51fd\u6570\u5206\u4e3a\u51e0\u7c7b\uff1a\u5b57\u7b26\u4e32\u51fd\u6570\u6570\u7ec4\u51fd\u6570\u65e5\u671f\u548c\u65f6\u95f4\u51fd\u6570\u6570\u5b66\u51fd\u6570\u5176\u4ed6\u51fd\u6570\uff08\u5982\u6587\u4ef6\u64cd\u4f5c\u3001\u7f51\u7edc\u3001\u52a0\u5bc6\u548c\u56fe\u50cf\u5904\u7406\u51fd\u6570\uff09<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241026\/1729938275671cc363b47cc.jpg\" class=\"aligncenter\" title=\"PHP \u51fd\u6570\u6709\u54ea\u4e9b\u5e38\u89c1\u5206\u7c7b\uff1f\u63d2\u56fe\" alt=\"PHP \u51fd\u6570\u6709\u54ea\u4e9b\u5e38\u89c1\u5206\u7c7b\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>PHP \u51fd\u6570\u7684\u5206\u7c7b<\/strong><\/p>\n<p>PHP \u51fd\u6570\u4f9d\u636e\u5176\u529f\u80fd\u548c\u7528\u9014\uff0c\u53ef\u4ee5\u5206\u4e3a\u4ee5\u4e0b\u51e0\u7c7b\uff1a<\/p>\n<p><strong>\u5b57\u7b26\u4e32\u51fd\u6570<\/strong><\/p>\n<p>\u8fd9\u4e9b\u51fd\u6570\u7528\u4e8e\u5904\u7406\u5b57\u7b26\u4e32\uff0c\u5e38\u89c1\u7684\u5305\u62ec\uff1a<code>strlen()<\/code>\u3001<code>strtoupper()<\/code>\u3001<code>strtolower()<\/code>\u3001<code>str_replace()<\/code>\u3002<\/p>\n<p><strong>\u6570\u7ec4\u51fd\u6570<\/strong><\/p>\n<p>\u8fd9\u4e9b\u51fd\u6570\u7528\u4e8e\u64cd\u4f5c\u6570\u7ec4\uff0c\u5e38\u89c1\u7684\u5305\u62ec\uff1a<code>array_merge()<\/code>\u3001<code>array_pop()<\/code>\u3001<code>array_shift()<\/code>\u3001<code>in_array()<\/code>\u3002<\/p>\n<p><strong>\u65e5\u671f\u548c\u65f6\u95f4\u51fd\u6570<\/strong><\/p>\n<p>\u8fd9\u4e9b\u51fd\u6570\u7528\u4e8e\u5904\u7406\u65e5\u671f\u548c\u65f6\u95f4\uff0c\u5e38\u89c1\u7684\u5305\u62ec\uff1a<code>date()<\/code>\u3001<code>strtotime()<\/code>\u3001<code>mktime()<\/code>\u3001<code>gmdate()<\/code>\u3002<\/p>\n<p><strong>\u6570\u5b66\u51fd\u6570<\/strong><\/p>\n<p>\u8fd9\u4e9b\u51fd\u6570\u7528\u4e8e\u6267\u884c\u6570\u5b66\u8fd0\u7b97\uff0c\u5e38\u89c1\u7684\u5305\u62ec\uff1a<code>abs()<\/code>\u3001<code>sqrt()<\/code>\u3001<code>round()<\/code>\u3001<code>max()<\/code>\u3002<\/p>\n<p><strong>\u5176\u4ed6\u51fd\u6570<\/strong><\/p>\n<p>\u6b64\u5916\uff0c\u8fd8\u6709\u8bb8\u591a\u5176\u4ed6\u7528\u9014\u5e7f\u6cdb\u7684\u51fd\u6570\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\u6587\u4ef6\u64cd\u4f5c\u51fd\u6570\uff1a<code>file_get_contents()<\/code>\u3001<code>file_put_contents()<\/code><\/li>\n<li>\u7f51\u7edc\u51fd\u6570\uff1a<code>curl_init()<\/code>\u3001<code>socket_create()<\/code><\/li>\n<li>\u52a0\u5bc6\u51fd\u6570\uff1a<code>hash()<\/code>\u3001<code>openssl_encrypt()<\/code><\/li>\n<li>\u56fe\u50cf\u5904\u7406\u51fd\u6570\uff1a<code>imagecreate()<\/code>\u3001<code>imagejpeg()<\/code><\/li>\n<\/ul>\n<p><strong>\u5b9e\u6218\u6848\u4f8b<\/strong><\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a PHP \u51fd\u6570\u5b9e\u6218\u6848\u4f8b\uff0c\u6f14\u793a\u5982\u4f55\u4f7f\u7528\u5b57\u7b26\u4e32\u51fd\u6570\u5904\u7406\u7528\u6237\u8f93\u5165\uff1a<\/p>\n<pre>&lt;?php\n\n\/\/ \u83b7\u53d6\u7528\u6237\u8f93\u5165\n$username = $_POST['username'];\n\n\/\/ \u5c06\u7528\u6237\u540d\u8f6c\u4e3a\u5927\u5199\n$username = strtoupper($username);\n\n\/\/ \u68c0\u67e5\u7528\u6237\u540d\u662f\u5426\u4e3a\u7a7a\nif (empty($username)) {\n  \/\/ \u8f93\u51fa\u9519\u8bef\u4fe1\u606f\n  echo \"\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a\uff01\";\n} else {\n  \/\/ \u8f93\u51fa\u7528\u6237\u540d\n  echo \"\u6b22\u8fce\uff0c$username\uff01\";\n}\n\n?&gt;<\/pre>\n<p>\u672c\u7bc7\u5173\u4e8e\u300aPHP \u51fd\u6570\u6709\u54ea\u4e9b\u5e38\u89c1\u5206\u7c7b\uff1f\u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP \u51fd\u6570\u6709\u54ea\u4e9b\u5e38\u89c1\u5206\u7c7b\uff1f \u4eca\u65e5\u4e0d\u80af\u57cb\u5934\uff0c\u660e\u65e5\u4f55\u4ee5\u62ac\u5934\uff01\u6bcf\u65e5\u4e00\u53e5\u52aa\u529b\u81ea\u5df1\u7684\u8bdd\u54c8\u54c8~\u54c8\u55bd\uff0c\u4eca\u5929\u6211\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7\u300aPHP \u51fd\u6570\u6709\u54ea\u4e9b\u5e38\u89c1\u5206\u7c7b\uff1f\u300b\uff0c\u4e3b\u8981\u5185\u5bb9\u662f\u8bb2\u89e3\u7b49\u7b49\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u53ef\u4ee5\u6536\u85cf\u6216\u8005\u6709\u66f4\u597d\u7684\u5efa\u8bae\u5728\u8bc4\u8bba\u63d0\u51fa\uff0c\u6211\u90fd\u4f1a\u8ba4\u771f\u770b\u7684\uff01\u5927\u5bb6\u4e00\u8d77\u8fdb\u6b65\uff0c\u4e00\u8d77\u5b66\u4e60\uff01 PHP \u51fd\u6570\u5206\u4e3a\u51e0\u7c7b\uff1a\u5b57\u7b26\u4e32\u51fd\u6570\u6570\u7ec4\u51fd\u6570\u65e5\u671f\u548c\u65f6\u95f4\u51fd\u6570\u6570\u5b66\u51fd\u6570\u5176\u4ed6\u51fd\u6570\uff08\u5982\u6587\u4ef6\u64cd\u4f5c\u3001\u7f51\u7edc\u3001\u52a0\u5bc6\u548c\u56fe\u50cf\u5904\u7406\u51fd\u6570\uff09 PHP \u51fd\u6570\u7684\u5206\u7c7b PHP \u51fd\u6570\u4f9d\u636e\u5176\u529f\u80fd\u548c\u7528\u9014\uff0c\u53ef\u4ee5\u5206\u4e3a\u4ee5\u4e0b\u51e0\u7c7b\uff1a \u5b57\u7b26\u4e32\u51fd\u6570 \u8fd9\u4e9b\u51fd\u6570\u7528\u4e8e\u5904\u7406\u5b57\u7b26\u4e32\uff0c\u5e38\u89c1\u7684\u5305\u62ec\uff1astrlen()\u3001strtoupper()\u3001strtolower()\u3001str_replace()\u3002 \u6570\u7ec4\u51fd\u6570 \u8fd9\u4e9b\u51fd\u6570\u7528\u4e8e\u64cd\u4f5c\u6570\u7ec4\uff0c\u5e38\u89c1\u7684\u5305\u62ec\uff1aarray_merge()\u3001array_pop()\u3001array_shift()\u3001in_array()\u3002 \u65e5\u671f\u548c\u65f6\u95f4\u51fd\u6570 \u8fd9\u4e9b\u51fd\u6570\u7528\u4e8e\u5904\u7406\u65e5\u671f\u548c\u65f6\u95f4\uff0c\u5e38\u89c1\u7684\u5305\u62ec\uff1adate()\u3001strtotime()\u3001mktime()\u3001gmdate()\u3002 \u6570\u5b66\u51fd\u6570 \u8fd9\u4e9b\u51fd\u6570\u7528\u4e8e\u6267\u884c\u6570\u5b66\u8fd0\u7b97\uff0c\u5e38\u89c1\u7684\u5305\u62ec\uff1aabs()\u3001sqrt()\u3001round()\u3001max()\u3002 \u5176\u4ed6\u51fd\u6570 \u6b64\u5916\uff0c\u8fd8\u6709\u8bb8\u591a\u5176\u4ed6\u7528\u9014\u5e7f\u6cdb\u7684\u51fd\u6570\uff0c\u4f8b\u5982\uff1a \u6587\u4ef6\u64cd\u4f5c\u51fd\u6570\uff1afile_get_contents()\u3001file_put_contents() \u7f51\u7edc\u51fd\u6570\uff1acurl_init()\u3001socket_create() \u52a0\u5bc6\u51fd\u6570\uff1ahash()\u3001openssl_encrypt() \u56fe\u50cf\u5904\u7406\u51fd\u6570\uff1aimagecreate()\u3001imagejpeg() \u5b9e\u6218\u6848\u4f8b \u4e0b\u9762\u662f\u4e00\u4e2a PHP \u51fd\u6570\u5b9e\u6218\u6848\u4f8b\uff0c\u6f14\u793a\u5982\u4f55\u4f7f\u7528\u5b57\u7b26\u4e32\u51fd\u6570\u5904\u7406\u7528\u6237\u8f93\u5165\uff1a &lt;?php \/\/ \u83b7\u53d6\u7528\u6237\u8f93\u5165 $username = $_POST[&#8216;username&#8217;]; \/\/ \u5c06\u7528\u6237\u540d\u8f6c\u4e3a\u5927\u5199 $username = strtoupper($username); \/\/ \u68c0\u67e5\u7528\u6237\u540d\u662f\u5426\u4e3a\u7a7a if (empty($username)) { \/\/ \u8f93\u51fa\u9519\u8bef\u4fe1\u606f echo &#8220;\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a\uff01&#8221;; } else { \/\/ \u8f93\u51fa\u7528\u6237\u540d echo &#8220;\u6b22\u8fce\uff0c$username\uff01&#8221;; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-47824","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47824","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=47824"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47824\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=47824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=47824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=47824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}