{"id":183751,"date":"2024-05-08T21:52:14","date_gmt":"2024-05-08T13:52:14","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/183751.html"},"modified":"2024-05-08T21:52:20","modified_gmt":"2024-05-08T13:52:20","slug":"php%e6%80%8e%e4%b9%88%e7%94%a8%e6%ad%a3%e5%88%99%e5%8c%b9%e9%85%8d%e9%82%ae%e7%ae%b1%e6%a0%bc%e5%bc%8f%e5%91%a2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/183751.html","title":{"rendered":"php\u600e\u4e48\u7528\u6b63\u5219\u5339\u914d\u90ae\u7bb1\u683c\u5f0f\u5462"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27074448\/921b1e03-7168-4319-9f2f-b92df148b76c.webp\" alt=\"php\u600e\u4e48\u7528\u6b63\u5219\u5339\u914d\u90ae\u7bb1\u683c\u5f0f\u5462\" \/><\/p>\n<p><p>\u5728PHP\u4e2d\uff0c\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u90ae\u7bb1\u683c\u5f0f\u662f\u4e00\u79cd\u9ad8\u6548\u3001\u7075\u6d3b\u7684\u65b9\u6cd5\u3002<strong>\u4e3b\u8981\u6280\u5de7\u5305\u62ec\u6784\u9020\u5408\u9002\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u3001\u4f7f\u7528<code>preg_match()<\/code>\u51fd\u6570\u8fdb\u884c\u5339\u914d<\/strong>\u3002\u6784\u9020\u6b63\u5219\u8868\u8fbe\u5f0f\u65f6\u9700\u6ce8\u610f\u8bc6\u522b\u90ae\u7bb1\u7684\u57fa\u672c\u7ed3\u6784\uff0c\u5982\u7528\u6237\u540d\u3001\u6807\u8bc6\u7b26&quot;@&quot;\u3001\u57df\u540d\u7b49\u3002\u4f8b\u5982\uff0c\u4e00\u4e2a\u7b80\u5355\u800c\u5e38\u89c1\u7684\u90ae\u7bb1\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u662f<code>\/^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$\/<\/code>\uff0c\u5b83\u6db5\u76d6\u4e86\u5927\u591a\u6570\u90ae\u7bb1\u683c\u5f0f\u7684\u9a8c\u8bc1\u3002<\/p>\n<\/p>\n<p><h2><strong>\u4e00\u3001\u7406\u89e3\u90ae\u7bb1\u683c\u5f0f<\/strong><\/h2>\n<\/p>\n<p><p>\u90ae\u7bb1\u7531\u4e09\u90e8\u5206\u7ec4\u6210\uff1a\u7528\u6237\u540d\u3001&quot;@&quot;\u7b26\u53f7\u4ee5\u53ca\u57df\u540d\u3002\u5728\u6784\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f\u4e4b\u524d\uff0c\u9996\u5148\u660e\u786e\u8fd9\u4e09\u4e2a\u90e8\u5206\u5404\u81ea\u53ef\u4ee5\u5305\u542b\u7684\u5b57\u7b26\u3002<strong>\u7528\u6237\u540d\u901a\u5e38\u5305\u62ec\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u70b9\u3001\u4e0b\u5212\u7ebf\u4ee5\u53ca\u8fde\u63a5\u7b26<\/strong>\u3002\u57df\u540d\u5219\u7531\u591a\u4e2a\u901a\u8fc7\u70b9\u8fde\u63a5\u7684\u90e8\u5206\u7ec4\u6210\uff0c\u6bcf\u90e8\u5206\u540c\u6837\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u8fde\u63a5\u7b26\uff0c\u4f46\u662f\u4e0d\u80fd\u4ee5\u8fde\u63a5\u7b26\u5f00\u59cb\u6216\u7ed3\u675f\u3002<\/p>\n<\/p>\n<p><h3><strong>\u89e3\u6790\u90ae\u7bb1\u683c\u5f0f<\/strong><\/h3>\n<\/p>\n<p><p>\u7528\u6237\u540d\u548c\u57df\u540d\u7684\u7075\u6d3b\u7ec4\u5408\u7ed9\u90ae\u7bb1\u683c\u5f0f\u5e26\u6765\u4e86\u591a\u6837\u6027\uff0c\u4f46\u540c\u65f6\u4e5f\u5f15\u5165\u4e86\u590d\u6742\u6027\u3002\u4f8b\u5982\uff0c\u5e94\u8be5\u5141\u8bb8\u5305\u542b\u70b9\u548c\u4e0b\u5212\u7ebf\u7684\u7528\u6237\u540d\uff0c\u540c\u65f6\u4e5f\u8981\u786e\u4fdd\u57df\u540d\u90e8\u5206\u9075\u5faa\u56fd\u9645\u5316\u57df\u540d\uff08IDN\uff09\u7684\u89c4\u8303\u3002\u8fd9\u4e9b\u7279\u5b9a\u8981\u6c42\u4f1a\u5f71\u54cd\u5230\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u590d\u6742\u5ea6\u3002<\/p>\n<\/p>\n<p><h3><strong>\u4e00\u822c\u89c4\u5219\u548c\u4f8b\u5916<\/strong><\/h3>\n<\/p>\n<p><p>\u867d\u7136\u5927\u591a\u6570\u90ae\u7bb1\u7b26\u5408\u6807\u51c6\u683c\u5f0f\uff0c\u4f46\u603b\u6709\u4f8b\u5916\u3002\u4f8b\u5982\uff0c\u4e00\u4e9b\u8001\u7684\u7535\u5b50\u90ae\u4ef6\u7cfb\u7edf\u53ef\u80fd\u5141\u8bb8\u4f7f\u7528\u4e0d\u5e38\u89c1\u7684\u5b57\u7b26\u3002\u7f16\u5199\u6b63\u5219\u8868\u8fbe\u5f0f\u65f6\uff0c\u5e94\u5f53\u8003\u8651\u5230\u8fd9\u4e9b\u7279\u6b8a\u60c5\u51b5\uff0c\u540c\u65f6\u4e5f\u610f\u8bc6\u5230\u8fc7\u4e8e\u5bbd\u6cdb\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u80fd\u4f1a\u5f15\u5165\u8bef\u5339\u914d\u3002<\/p>\n<\/p>\n<p><h2><strong>\u4e8c\u3001\u6784\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f<\/strong><\/h2>\n<\/p>\n<p><p><strong>\u6784\u5efa\u9ad8\u6548\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5173\u952e\u5728\u4e8e\u5e73\u8861\u51c6\u786e\u6027\u548c\u901a\u7528\u6027<\/strong>\u3002\u592a\u5177\u4f53\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u80fd\u65e0\u6cd5\u6db5\u76d6\u6240\u6709\u5408\u6cd5\u7684\u90ae\u7bb1\u5730\u5740\uff0c\u800c\u592a\u5bbd\u6cdb\u7684\u5219\u53ef\u80fd\u5339\u914d\u5230\u4e0d\u5408\u6cd5\u7684\u5730\u5740\u3002<\/p>\n<\/p>\n<p><h3><strong>\u57fa\u7840\u6a21\u5f0f<\/strong><\/h3>\n<\/p>\n<p><p>\u4e00\u4e2a\u57fa\u7840\u7684\u90ae\u7bb1\u5339\u914d\u6b63\u5219\u8868\u8fbe\u5f0f\u5982<code>\/^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$\/<\/code>\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u540d\u90e8\u5206\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u70b9\u548c\u4e0b\u5212\u7ebf\uff0c\u57df\u540d\u90e8\u5206\u5219\u5fc5\u987b\u5305\u542b\u81f3\u5c11\u4e00\u4e2a\u70b9\uff0c\u4ee5\u533a\u5206\u9876\u7ea7\u57df\u548c\u4e8c\u7ea7\u57df\u3002<\/p>\n<\/p>\n<p><h3><strong>\u589e\u5f3a\u6a21\u5f0f<\/strong><\/h3>\n<\/p>\n<p><p>\u968f\u7740\u5bf9\u90ae\u7bb1\u683c\u5f0f\u8981\u6c42\u7684\u6df1\u5165\uff0c\u53ef\u4ee5\u5bf9\u4e0a\u8ff0\u57fa\u7840\u6a21\u5f0f\u8fdb\u884c\u589e\u5f3a\uff0c\u4ee5\u5904\u7406\u66f4\u591a\u7ec6\u8282\uff0c\u5982\u9650\u5236\u57df\u540d\u90e8\u5206\u53ea\u80fd\u4ee5\u5b57\u6bcd\u6216\u6570\u5b57\u5f00\u5934\u548c\u7ed3\u5c3e\uff0c\u6216\u8005\u589e\u52a0\u5bf9\u7279\u5b9a\u9876\u7ea7\u57df\u7684\u68c0\u67e5\u3002<\/p>\n<\/p>\n<p><h2><strong>\u4e09\u3001\u5e94\u7528preg_match\u51fd\u6570<\/strong><\/h2>\n<\/p>\n<p><p>\u5728PHP\u4e2d\uff0c<code>preg_match()<\/code>\u51fd\u6570\u662f\u6267\u884c\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u7684\u4e3b\u8981\u5de5\u5177\u3002\u6b63\u786e\u4f7f\u7528\u8be5\u51fd\u6570\u4e0d\u4ec5\u80fd\u591f\u9a8c\u8bc1\u90ae\u7bb1\u683c\u5f0f\uff0c\u8fd8\u80fd\u4ece\u4e2d\u63d0\u53d6\u6709\u7528\u7684\u4fe1\u606f\uff0c\u5982\u7528\u6237\u540d\u548c\u57df\u540d\u90e8\u5206\u3002<\/p>\n<\/p>\n<p><h3><strong>\u57fa\u672c\u4f7f\u7528<\/strong><\/h3>\n<\/p>\n<p><p><code>preg_match()<\/code>\u51fd\u6570\u9700\u8981\u4e24\u4e2a\u53c2\u6570\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u548c\u5f85\u9a8c\u8bc1\u7684\u5b57\u7b26\u4e32\uff0c\u5982\u679c\u5339\u914d\u6210\u529f\uff0c\u8fd4\u56de1\uff0c\u5426\u5219\u8fd4\u56de0\u3002\u5e94\u7528\u4e8e\u90ae\u7bb1\u9a8c\u8bc1\uff0c\u4ee3\u7801\u53ef\u80fd\u5982\u4e0b\uff1a<code>if (preg_match(&#039;\/^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$\/&#039;, $em<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>l)) {echo &quot;Valid email&quot;;}<\/code>\u3002<\/p>\n<\/p>\n<p><h3><strong>\u9ad8\u7ea7\u5e94\u7528<\/strong><\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u66f4\u597d\u5730\u9002\u5e94\u591a\u6837\u5316\u7684\u5e94\u7528\u573a\u666f\uff0c<code>preg_match()<\/code>\u53ef\u4ee5\u4e0e\u5176\u4ed6PHP\u6b63\u5219\u8868\u8fbe\u5f0f\u51fd\u6570\u7ed3\u5408\u4f7f\u7528\uff0c\u5982<code>preg_match_all()<\/code>\uff0c\u6216\u8005\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u5e94\u7528\u65ad\u8a00\u7b49\u9ad8\u7ea7\u6280\u5de7\uff0c\u8fdb\u4e00\u6b65\u63d0\u9ad8\u5339\u914d\u7684\u51c6\u786e\u6027\u548c\u7075\u6d3b\u6027\u3002<\/p>\n<\/p>\n<p><h2><strong>\u56db\u3001\u5b9e\u4f8b\u5206\u6790\u548c\u6d4b\u8bd5<\/strong><\/h2>\n<\/p>\n<p><p>\u4e3a\u4e86\u786e\u4fdd\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u51c6\u786e\u6027\u548c\u5065\u58ef\u6027\uff0c\u901a\u8fc7\u5b9e\u4f8b\u5206\u6790\u548c\u6d4b\u8bd5\u662f\u5341\u5206\u5fc5\u8981\u7684\u3002\u8fd9\u4e0d\u4ec5\u53ef\u4ee5\u5e2e\u52a9\u53d1\u73b0\u5e76\u4fee\u6b63\u9519\u8bef\uff0c\u8fd8\u80fd\u589e\u5f3a\u5bf9\u6b63\u5219\u8868\u8fbe\u5f0f\u5404\u90e8\u5206\u7684\u7406\u89e3\u3002<\/p>\n<\/p>\n<p><h3><strong>\u5b9e\u4f8b\u5206\u6790<\/strong><\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u5206\u6790\u4e00\u7cfb\u5217\u4e0d\u540c\u7c7b\u578b\u7684\u90ae\u7bb1\u5730\u5740\uff0c\u53ef\u4ee5\u9a8c\u8bc1\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u8986\u76d6\u8303\u56f4\u548c\u9650\u5236\u6761\u4ef6\u3002\u8fd9\u6709\u52a9\u4e8e\u53d1\u73b0\u6f5c\u5728\u7684\u4e0d\u8db3\uff0c\u5e76\u53ca\u65f6\u8fdb\u884c\u8c03\u6574\u548c\u4f18\u5316\u3002<\/p>\n<\/p>\n<p><h3><strong>\u6d4b\u8bd5\u548c\u9a8c\u8bc1<\/strong><\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u4e00\u7ec4\u9884\u5b9a\u4e49\u7684\u6d4b\u8bd5\u90ae\u7bb1\u5730\u5740\uff0c\u53ef\u4ee5\u7cfb\u7edf\u5730\u9a8c\u8bc1\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u6709\u6548\u6027\u3002\u8fd9\u4e9b\u6d4b\u8bd5\u5730\u5740\u5e94\u8be5\u5305\u62ec\u5408\u6cd5\u7684\u90ae\u7bb1\u683c\u5f0f\u4ee5\u53ca\u5e38\u89c1\u7684\u9519\u8bef\u683c\u5f0f\uff0c\u4ee5\u6b64\u6765\u68c0\u67e5\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u51c6\u786e\u6027\u548c\u9c81\u68d2\u6027\u3002<\/p>\n<\/p>\n<p><p>\u603b\u800c\u8a00\u4e4b\uff0c<strong>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5728PHP\u4e2d\u5339\u914d\u90ae\u7bb1\u683c\u5f0f\u662f\u4e00\u4e2a\u6d89\u53ca\u591a\u65b9\u9762\u77e5\u8bc6\u548c\u6280\u5de7\u7684\u8fc7\u7a0b<\/strong>\u3002\u901a\u8fc7\u7406\u89e3\u90ae\u7bb1\u7684\u57fa\u672c\u7ed3\u6784\uff0c\u5408\u7406\u6784\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5e76\u6709\u6548\u5730\u5229\u7528<code>preg_match()<\/code>\u7b49\u51fd\u6570\u8fdb\u884c\u5339\u914d\uff0c\u53ef\u4ee5\u9ad8\u6548\u5730\u9a8c\u8bc1\u90ae\u7bb1\u683c\u5f0f\u3002\u540c\u65f6\uff0c\u901a\u8fc7\u4ed4\u7ec6\u7684\u5b9e\u4f8b\u5206\u6790\u548c\u5168\u9762\u7684\u6d4b\u8bd5\uff0c\u53ef\u4ee5\u786e\u4fdd\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u51c6\u786e\u6027\u548c\u5065\u58ee\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u5982\u4f55\u5229\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\u90ae\u7bb1\u683c\u5f0f\uff1f<\/strong><\/p>\n<p>\u9a8c\u8bc1\u90ae\u7bb1\u683c\u5f0f\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u4efb\u52a1\u3002\u8981\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\u90ae\u7bb1\u683c\u5f0f\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n<ul>\n<li>\u521b\u5efa\u4e00\u4e2a\u5339\u914d\u90ae\u7bb1\u683c\u5f0f\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u4f8b\u5982\uff1a<code>\/^[\\w\\-\\.]+@[a-zA-Z0-9\\-]+(\\.[a-zA-Z]{2,})+$\/<\/code><\/li>\n<li>\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u8fdb\u884c\u5339\u914d\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>preg_match()<\/code>\u51fd\u6570\u8fdb\u884c\u5339\u914d\uff1a<code>preg_match(&#039;\/^[\\w\\-\\.]+@[a-zA-Z0-9\\-]+(\\.[a-zA-Z]{2,})+$\/&#039;, $email)<\/code><\/li>\n<li>\u5982\u679c\u5339\u914d\u6210\u529f\uff08\u8fd4\u56de1\uff09\uff0c\u5219\u8bf4\u660e\u90ae\u7bb1\u683c\u5f0f\u6b63\u786e\uff1b\u5982\u679c\u5339\u914d\u5931\u8d25\uff08\u8fd4\u56de0\uff09\uff0c\u5219\u8bf4\u660e\u90ae\u7bb1\u683c\u5f0f\u4e0d\u6b63\u786e\u3002<\/li>\n<\/ul>\n<p><strong>2. \u600e\u6837\u4f7f\u7528PHP\u9a8c\u8bc1\u90ae\u7bb1\u683c\u5f0f\u5e76\u63d0\u53d6\u90ae\u7bb1\u7528\u6237\u540d\u548c\u57df\u540d\uff1f<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u9700\u8981\u9a8c\u8bc1\u90ae\u7bb1\u683c\u5f0f\u7684\u540c\u65f6\u63d0\u53d6\u90ae\u7bb1\u7684\u7528\u6237\u540d\u548c\u57df\u540d\u90e8\u5206\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u62ec\u53f7\u5206\u7ec4\u529f\u80fd\u6765\u5b9e\u73b0\u3002<\/p>\n<p>\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u6765\u63d0\u53d6\u90ae\u7bb1\u7684\u7528\u6237\u540d\u548c\u57df\u540d\uff1a<\/p>\n<ul>\n<li>\u521b\u5efa\u5339\u914d\u90ae\u7bb1\u683c\u5f0f\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5e76\u4f7f\u7528\u62ec\u53f7\u5c06\u7528\u6237\u540d\u548c\u57df\u540d\u90e8\u5206\u5206\u7ec4\uff0c\u4f8b\u5982\uff1a<code>\/^(\\w+)\\@(\\w+\\.\\w+)$<\/code><\/li>\n<li>\u4f7f\u7528<code>preg_match()<\/code>\u51fd\u6570\u8fdb\u884c\u5339\u914d\uff0c\u5e76\u4f7f\u7528\u989d\u5916\u7684\u53d8\u91cf\u6765\u63a5\u6536\u5339\u914d\u7ed3\u679c\uff0c\u4f8b\u5982\uff1a<code>preg_match(&#039;\/^(\\w+)\\@(\\w+\\.\\w+)$\/&#039;, $email, $matches)<\/code><\/li>\n<li>\u5982\u679c\u5339\u914d\u6210\u529f\uff08\u8fd4\u56de1\uff09\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7<code>$matches<\/code>\u6570\u7ec4\u6765\u63d0\u53d6\u90ae\u7bb1\u7684\u7528\u6237\u540d\u548c\u57df\u540d\uff0c\u4f8b\u5982\uff1a<code>$username = $matches[1]; $domain = $matches[2];<\/code><\/li>\n<\/ul>\n<p>\u73b0\u5728\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u63d0\u53d6\u5230\u7684\u7528\u6237\u540d\u548c\u57df\u540d\u8fdb\u884c\u540e\u7eed\u7684\u64cd\u4f5c\u3002<\/p>\n<p><strong>3. \u5728PHP\u4e2d\uff0c\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u66ff\u6362\u5b57\u7b26\u4e32\u4e2d\u7684\u90ae\u7bb1\u5730\u5740\uff1f<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u9700\u8981\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u66ff\u6362\u5b57\u7b26\u4e32\u4e2d\u7684\u90ae\u7bb1\u5730\u5740\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n<ul>\n<li>\u521b\u5efa\u5339\u914d\u90ae\u7bb1\u683c\u5f0f\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u4f8b\u5982\uff1a<code>\/[\\w\\-\\.]+@[a-zA-Z0-9\\-]+(\\.[a-zA-Z]{2,})+\/<\/code><\/li>\n<li>\u4f7f\u7528<code>preg_replace()<\/code>\u51fd\u6570\u8fdb\u884c\u66ff\u6362\uff0c\u4f8b\u5982\uff1a<code>$newString = preg_replace(&#039;\/[\\w\\-\\.]+@[a-zA-Z0-9\\-]+(\\.[a-zA-Z]{2,})+\/&#039;, &#039;REPLACEMENT&#039;, $inputString)<\/code><\/li>\n<li>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u4f1a\u5c06\u5339\u914d\u5230\u7684\u90ae\u7bb1\u5730\u5740\u66ff\u6362\u4e3a\u6307\u5b9a\u7684\u66ff\u6362\u5b57\u7b26\u4e32\uff08\u5728\u6b64\u4f8b\u4e2d\u4e3a&quot;REPLACEMENT&quot;\uff09\u3002\u4f60\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u9700\u6c42\u6765\u4fee\u6539\u66ff\u6362\u5b57\u7b26\u4e32\u3002<\/li>\n<\/ul>\n<p>\u73b0\u5728\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u66ff\u6362\u540e\u7684\u5b57\u7b26\u4e32<code>$newString<\/code>\u8fdb\u884c\u540e\u7eed\u7684\u64cd\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728PHP\u4e2d\uff0c\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u90ae\u7bb1\u683c\u5f0f\u662f\u4e00\u79cd\u9ad8\u6548\u3001\u7075\u6d3b\u7684\u65b9\u6cd5\u3002\u4e3b\u8981\u6280\u5de7\u5305\u62ec\u6784\u9020\u5408\u9002\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u3001\u4f7f\u7528preg_ [&hellip;]","protected":false},"author":3,"featured_media":183758,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/183751"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=183751"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/183751\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/183758"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=183751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=183751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=183751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}