{"id":6901,"date":"2024-11-14T11:13:05","date_gmt":"2024-11-14T03:13:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6901\/"},"modified":"2024-11-14T11:13:05","modified_gmt":"2024-11-14T03:13:05","slug":"%e5%a6%82%e4%bd%95%e8%af%86%e5%88%ab%e6%95%b0%e6%8d%ae%e5%ba%93%e6%95%b0%e6%8d%ae%e4%b8%ad%e7%9a%84%e4%b8%ad%e6%96%87%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6901\/","title":{"rendered":"\u5982\u4f55\u8bc6\u522b\u6570\u636e\u5e93\u6570\u636e\u4e2d\u7684\u4e2d\u6587\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173007361656524.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u8bc6\u522b\u6570\u636e\u5e93\u6570\u636e\u4e2d\u7684\u4e2d\u6587\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u8bc6\u522b\u6570\u636e\u5e93\u6570\u636e\u4e2d\u7684\u4e2d\u6587\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728\u6570\u636e\u5e93\u4e2d\u8bc6\u522b\u4e2d\u6587<\/strong><\/p>\n<p>\u5728\u5904\u7406\u6765\u81ea\u6570\u636e\u5e93\u7684\u6570\u636e\u65f6\uff0c\u786e\u5b9a\u5176\u4e2d\u662f\u5426\u5b58\u5728\u4e2d\u6587\u81f3\u5173\u91cd\u8981\u3002\u4e0b\u9762\u5217\u51fa\u4e86\u4e24\u79cd\u5224\u65ad\u4e2d\u6587\u7684\u65b9\u6cd5\uff1a<\/p>\n<p><strong>\u6570\u636e\u5e93\u5c42\u65b9\u6cd5<\/strong><\/p>\n<p>\u6dfb\u52a0\u201cis_cn\u201d\u5b57\u6bb5\uff1a\u4e3a\u6570\u636e\u8868\u6dfb\u52a0\u4e00\u4e2a\u5e03\u5c14\u7c7b\u578b\u7684\u201cis_cn\u201d\u5b57\u6bb5\uff0c\u7528\u4e8e\u6307\u793a\u8be5\u884c\u6570\u636e\u4e2d\u662f\u5426\u5b58\u5728\u4e2d\u6587\u3002\u7136\u540e\uff0c\u6279\u91cf\u751f\u6210\u6b64\u5b57\u6bb5\uff0c\u5e76\u5c06\u503c\u8bbe\u7f6e\u4e3a 0\uff08\u5426\uff09\u6216 1\uff08\u662f\uff09\u3002<\/p>\n<p><strong>\u5e94\u7528\u7a0b\u5e8f\u5c42\u65b9\u6cd5<\/strong><\/p>\n<pre>&lt;?php\n\n$string = \"\u6d4b\u8bd5\u6570\u636e\";\n\nif (preg_match('\/[x{4e00}-x{9fa5}]\/u', $string)) {\n    \/\/ \u5b58\u5728\u4e2d\u6587\n} else {\n    \/\/ \u4e0d\u5b58\u5728\u4e2d\u6587\n}\n\n?&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e0a\u8ff0 php \u4ee3\u7801\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f [x{4e00}-x{9fa5}]\/u \u5224\u65ad\u5b57\u7b26\u4e32\u4e2d\u662f\u5426\u5b58\u5728\u4e2d\u6587\u3002\u8be5\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d unicode \u8303\u56f4\u4e3a u+4e00 \u5230 u+9fa5 \u7684\u6240\u6709\u4e2d\u6587\u5b57\u7b26\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u8bc6\u522b\u6570\u636e\u5e93\u6570\u636e\u4e2d\u7684\u4e2d\u6587\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5728\u6570\u636e\u5e93\u4e2d\u8bc6\u522b\u4e2d\u6587 \u5728\u5904\u7406\u6765\u81ea\u6570\u636e\u5e93\u7684\u6570\u636e\u65f6\uff0c\u786e\u5b9a\u5176\u4e2d\u662f\u5426\u5b58\u5728\u4e2d\u6587\u81f3\u5173\u91cd\u8981\u3002\u4e0b\u9762\u5217\u51fa\u4e86\u4e24\u79cd\u5224\u65ad\u4e2d\u6587\u7684\u65b9\u6cd5\uff1a \u6570\u636e\u5e93\u5c42\u65b9\u6cd5 \u6dfb\u52a0\u201cis_cn\u201d\u5b57\u6bb5\uff1a\u4e3a\u6570\u636e\u8868\u6dfb\u52a0\u4e00\u4e2a\u5e03\u5c14\u7c7b\u578b\u7684\u201cis_cn\u201d\u5b57\u6bb5\uff0c\u7528\u4e8e\u6307\u793a\u8be5\u884c\u6570\u636e\u4e2d\u662f\u5426\u5b58\u5728\u4e2d\u6587\u3002\u7136\u540e\uff0c\u6279\u91cf\u751f\u6210\u6b64\u5b57\u6bb5\uff0c\u5e76\u5c06\u503c\u8bbe\u7f6e\u4e3a 0\uff08\u5426\uff09\u6216 1\uff08\u662f\uff09\u3002 \u5e94\u7528\u7a0b\u5e8f\u5c42\u65b9\u6cd5 &lt;?php $string = &#8220;\u6d4b\u8bd5\u6570\u636e&#8221;; if (preg_match(&#8216;\/[x{4e00}-x{9fa5}]\/u&#8217;, $string)) { \/\/ \u5b58\u5728\u4e2d\u6587 } else { \/\/ \u4e0d\u5b58\u5728\u4e2d\u6587 } ?&gt; \u767b\u5f55\u540e\u590d\u5236 \u4e0a\u8ff0 php \u4ee3\u7801\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f [x{4e00}-x{9fa5}]\/u \u5224\u65ad\u5b57\u7b26\u4e32\u4e2d\u662f\u5426\u5b58\u5728\u4e2d\u6587\u3002\u8be5\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d unicode \u8303\u56f4\u4e3a u+4e00 \u5230 u+9fa5 \u7684\u6240\u6709\u4e2d\u6587\u5b57\u7b26\u3002 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u8bc6\u522b\u6570\u636e\u5e93\u6570\u636e\u4e2d\u7684\u4e2d\u6587\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/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-6901","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6901","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=6901"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6901\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}