{"id":2206,"date":"2023-03-17T23:14:05","date_gmt":"2023-03-17T15:14:05","guid":{"rendered":"https:\/\/www.tra56.com\/?p=2206"},"modified":"2023-03-17T23:14:05","modified_gmt":"2023-03-17T15:14:05","slug":"2206","status":"publish","type":"post","link":"https:\/\/www.tra56.com\/2206.html","title":{"rendered":"PHP\u5904\u7406\u5fae\u4fe1\u6635\u79f0\u7279\u6b8a\u7b26\u53f7\u8fc7\u6ee4\u65b9\u6cd5"},"content":{"rendered":"

\u6211\u4eec\u5728\u901a\u8fc7PHP\u83b7\u53d6\u5fae\u4fe1\u6635\u79f0\uff0c\u5e76\u4e14\u5b58\u4e8e\u6570\u636e\u5e93\u7684\u65f6\u5019\uff0c\u7531\u4e8e\u4e00\u4e9b\u6635\u79f0\u5e26\u6709\u7279\u6b8a\u7b26\u53f7<\/a>\uff0c\u6240\u4ee5\u5b58\u4e0d\u8fdb\u53bb\uff0c\u8fd9\u65f6\u5019\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u65b9\u5f0f\u6765\u5904\u7406\u3002<\/p>\n

\u65b9\u6cd5\u4e00<\/p>\n

protected function removeEmoji($clean_text) {\r\n \r\n    \/\/ Match Emoticons\r\n    $regexEmoticons = '\/[\\x{1F600}-\\x{1F64F}]\/u';\r\n    $clean_text = preg_replace($regexEmoticons, '', $clean_text);\r\n \r\n    \/\/ Match Miscellaneous Symbols and Pictographs\r\n    $regexSymbols = '\/[\\x{1F300}-\\x{1F5FF}]\/u';\r\n    $clean_text = preg_replace($regexSymbols, '', $clean_text);\r\n \r\n    \/\/ Match Transport And Map Symbols\r\n    $regexTransport = '\/[\\x{1F680}-\\x{1F6FF}]\/u';\r\n    $clean_text = preg_replace($regexTransport, '', $clean_text);\r\n \r\n    \/\/ Match Miscellaneous Symbols\r\n    $regexMisc = '\/[\\x{2600}-\\x{26FF}]\/u';\r\n    $clean_text = preg_replace($regexMisc, '', $clean_text);\r\n \r\n    \/\/ Match Dingbats\r\n    $regexDingbats = '\/[\\x{2700}-\\x{27BF}]\/u';\r\n    $clean_text = preg_replace($regexDingbats, '', $clean_text);\r\n \r\n    return $clean_text;\r\n}<\/pre>\n

\u65b9\u6cd5\u4e8c<\/p>\n

preg_replace("\/[\\x{1F600}-\\x{1F64F}\\x{1F300}-\\x{1F5FF}\\x{1F680}-\\x{1F6FF}\\x{2600}-\\x{26FF}\\x{2700}-\\x{27BF}]\/u","","\u8fd9\u91cc\u662f\u6635\u79f0")<\/p>\n

\u65b9\u6cd5\u4e09<\/p>\n

\/\/ \u8fc7\u6ee4\u6389emoji\u8868\u60c5\r\nfunction filterEmoji($str){\r\n  $str = preg_replace_callback( '\/.\/u',\r\n      function (array $match) {\r\n        return strlen($match[0]) >= 4 ? '' : $match[0];\r\n      },\r\n      $str);\r\n   return $str;\r\n}<\/pre>\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

\u6211\u4eec\u5728\u901a\u8fc7PHP\u83b7\u53d6\u5fae\u4fe1\u6635\u79f0\uff0c\u5e76\u4e14\u5b58\u4e8e\u6570\u636e\u5e93\u7684\u65f6\u5019\uff0c\u7531\u4e8e\u4e00\u4e9b\u6635\u79f0\u5e26\u6709\u7279\u6b8a\u7b26\u53f7\uff0c\u6240\u4ee5\u5b58\u4e0d\u8fdb\u53bb\uff0c\u8fd9\u65f6\u5019\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,92],"tags":[],"class_list":["post-2206","post","type-post","status-publish","format-standard","hentry","category-php","category-phpcode"],"_links":{"self":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/2206"}],"collection":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/comments?post=2206"}],"version-history":[{"count":1,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/2206\/revisions"}],"predecessor-version":[{"id":2207,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/2206\/revisions\/2207"}],"wp:attachment":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/media?parent=2206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/categories?post=2206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/tags?post=2206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}