{"id":179850,"date":"2024-11-09T05:19:15","date_gmt":"2024-11-08T21:19:15","guid":{"rendered":"https:\/\/server.hk\/cnblog\/179850\/"},"modified":"2024-11-09T05:19:16","modified_gmt":"2024-11-08T21:19:16","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8%e6%95%b8%e6%93%9a%e5%ba%ab%e4%b8%ad%e9%81%8e%e6%bf%be%e6%8f%9b%e8%a1%8c%e7%ac%a6%ef%bc%8c%e9%81%bf%e5%85%8d%e6%95%b8%e6%93%9a%e6%b7%b7%e4%ba%82%ef%bc%9f-%e6%95%b8%e6%93%9a","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/179850\/","title":{"rendered":"\u5982\u4f55\u5728\u6578\u64da\u5eab\u4e2d\u904e\u6ffe\u63db\u884c\u7b26\uff0c\u907f\u514d\u6578\u64da\u6df7\u4e82\uff1f (\u6578\u64da\u5eab \u904e\u6ffe\u63db\u884c\u7b26)"},"content":{"rendered":"<h1 id=\"%e5%a6%82%e4%bd%95%e5%9c%a8%e6%95%b8%e6%93%9a%e5%ba%ab%e4%b8%ad%e9%81%8e%e6%bf%be%e6%8f%9b%e8%a1%8c%e7%ac%a6%ef%bc%8c%e9%81%bf%e5%85%8d%e6%95%b8%e6%93%9a%e6%b7%b7%e4%ba%82%ef%bc%9f-ImLcLUGwIN\">\u5982\u4f55\u5728\u6578\u64da\u5eab\u4e2d\u904e\u6ffe\u63db\u884c\u7b26\uff0c\u907f\u514d\u6578\u64da\u6df7\u4e82\uff1f<\/h1>\n<p>\u5728\u6578\u64da\u5eab\u7ba1\u7406\u4e2d\uff0c\u6578\u64da\u7684\u6574\u6f54\u6027\u548c\u4e00\u81f4\u6027\u662f\u81f3\u95dc\u91cd\u8981\u7684\u3002\u7279\u5225\u662f\u5728\u8655\u7406\u7528\u6236\u8f38\u5165\u7684\u6578\u64da\u6642\uff0c\u63db\u884c\u7b26\u53ef\u80fd\u6703\u5c0e\u81f4\u6578\u64da\u6df7\u4e82\uff0c\u5f71\u97ff\u67e5\u8a62\u548c\u5831\u544a\u7684\u6e96\u78ba\u6027\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u5982\u4f55\u5728\u6578\u64da\u5eab\u4e2d\u904e\u6ffe\u63db\u884c\u7b26\uff0c\u4ee5\u78ba\u4fdd\u6578\u64da\u7684\u6574\u6f54\u6027\u548c\u53ef\u7528\u6027\u3002<\/p>\n<h2 id=\"%e6%8f%9b%e8%a1%8c%e7%ac%a6%e7%9a%84%e4%be%86%e6%ba%90-ImLcLUGwIN\">\u63db\u884c\u7b26\u7684\u4f86\u6e90<\/h2>\n<p>\u63db\u884c\u7b26\u901a\u5e38\u51fa\u73fe\u5728\u7528\u6236\u8f38\u5165\u7684\u6587\u672c\u4e2d\uff0c\u4f8b\u5982\u5728\u7559\u8a00\u677f\u3001\u8a55\u8ad6\u5340\u6216\u4efb\u4f55\u9700\u8981\u7528\u6236\u8f38\u5165\u7684\u8868\u55ae\u4e2d\u3002\u7528\u6236\u53ef\u80fd\u6703\u4e0d\u7d93\u610f\u5730\u6309\u4e0b\u56de\u8eca\u9375\uff0c\u5c0e\u81f4\u6587\u672c\u4e2d\u51fa\u73fe\u4e0d\u5fc5\u8981\u7684\u63db\u884c\u7b26\u3002\u9019\u4e9b\u63db\u884c\u7b26\u5728\u6578\u64da\u5eab\u4e2d\u5b58\u5132\u5f8c\uff0c\u53ef\u80fd\u6703\u5f71\u97ff\u6578\u64da\u7684\u986f\u793a\u548c\u8655\u7406\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%9c%80%e8%a6%81%e9%81%8e%e6%bf%be%e6%8f%9b%e8%a1%8c%e7%ac%a6%ef%bc%9f-ImLcLUGwIN\">\u70ba\u4ec0\u9ebc\u9700\u8981\u904e\u6ffe\u63db\u884c\u7b26\uff1f<\/h2>\n<ul>\n<li><strong>\u6578\u64da\u4e00\u81f4\u6027\uff1a<\/strong>\u63db\u884c\u7b26\u53ef\u80fd\u6703\u5c0e\u81f4\u6578\u64da\u683c\u5f0f\u4e0d\u4e00\u81f4\uff0c\u5f71\u97ff\u6578\u64da\u7684\u67e5\u8a62\u548c\u5206\u6790\u3002<\/li>\n<li><strong>\u986f\u793a\u554f\u984c\uff1a<\/strong>\u5728\u524d\u7aef\u986f\u793a\u6642\uff0c\u63db\u884c\u7b26\u53ef\u80fd\u6703\u5c0e\u81f4\u6392\u7248\u6df7\u4e82\uff0c\u5f71\u97ff\u7528\u6236\u9ad4\u9a57\u3002<\/li>\n<li><strong>\u6578\u64da\u8655\u7406\uff1a<\/strong>\u5728\u9032\u884c\u6578\u64da\u8655\u7406\u548c\u5206\u6790\u6642\uff0c\u63db\u884c\u7b26\u53ef\u80fd\u6703\u5e72\u64fe\u7b97\u6cd5\u7684\u904b\u884c\uff0c\u5c0e\u81f4\u932f\u8aa4\u7684\u7d50\u679c\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e9%81%8e%e6%bf%be%e6%8f%9b%e8%a1%8c%e7%ac%a6-ImLcLUGwIN\">\u5982\u4f55\u904e\u6ffe\u63db\u884c\u7b26<\/h2>\n<p>\u904e\u6ffe\u63db\u884c\u7b26\u7684\u65b9\u5f0f\u53d6\u6c7a\u65bc\u6240\u4f7f\u7528\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u4e2d\u904e\u6ffe\u63db\u884c\u7b26\u7684\u65b9\u6cd5\uff1a<\/p>\n<h3 id=\"1-mysql-ImLcLUGwIN\">1. MySQL<\/h3>\n<p>\u5728MySQL\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>REPLACE()<\/code> \u51fd\u6578\u4f86\u904e\u6ffe\u63db\u884c\u7b26\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u793a\u4f8b\uff1a<\/p>\n<pre><code>UPDATE your_table\nSET your_column = REPLACE(REPLACE(your_column, 'r', ''), 'n', '')\nWHERE your_column LIKE '%n%' OR your_column LIKE '%r%';<\/code><\/pre>\n<p>\u9019\u6bb5\u4ee3\u78bc\u5c07\u6703\u628a\u6240\u6709\u7684\u56de\u8eca\u7b26\uff08r\uff09\u548c\u63db\u884c\u7b26\uff08n\uff09\u66ff\u63db\u70ba\u7a7a\u5b57\u7b26\u4e32\u3002<\/p>\n<h3 id=\"2-postgresql-ImLcLUGwIN\">2. PostgreSQL<\/h3>\n<p>\u5728PostgreSQL\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>REGEXP_REPLACE()<\/code> \u51fd\u6578\u4f86\u904e\u6ffe\u63db\u884c\u7b26\u3002\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n<pre><code>UPDATE your_table\nSET your_column = REGEXP_REPLACE(your_column, E'\\r?\\n', '', 'g')\nWHERE your_column ~ E'\\r?\\n';<\/code><\/pre>\n<p>\u9019\u6bb5\u4ee3\u78bc\u5c07\u6703\u628a\u6240\u6709\u7684\u63db\u884c\u7b26\u66ff\u63db\u70ba\u7a7a\u5b57\u7b26\u4e32\uff0c\u4e26\u4e14\u4f7f\u7528\u6b63\u5247\u8868\u9054\u5f0f\u4f86\u5339\u914d\u63db\u884c\u7b26\u3002<\/p>\n<h3 id=\"3-sql-server-ImLcLUGwIN\">3. SQL Server<\/h3>\n<p>\u5728SQL Server\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>REPLACE()<\/code> \u51fd\u6578\u4f86\u904e\u6ffe\u63db\u884c\u7b26\uff0c\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n<pre><code>UPDATE your_table\nSET your_column = REPLACE(REPLACE(your_column, CHAR(13), ''), CHAR(10), '')\nWHERE your_column LIKE '%' + CHAR(10) + '%' OR your_column LIKE '%' + CHAR(13) + '%';<\/code><\/pre>\n<p>\u9019\u6bb5\u4ee3\u78bc\u5c07\u6703\u628a\u6240\u6709\u7684\u56de\u8eca\u7b26\uff08CHAR(13)\uff09\u548c\u63db\u884c\u7b26\uff08CHAR(10)\uff09\u66ff\u63db\u70ba\u7a7a\u5b57\u7b26\u4e32\u3002<\/p>\n<h2 id=\"%e7%b5%90%e8%ab%96-ImLcLUGwIN\">\u7d50\u8ad6<\/h2>\n<p>\u904e\u6ffe\u63db\u884c\u7b26\u662f\u78ba\u4fdd\u6578\u64da\u5eab\u6578\u64da\u6574\u6f54\u6027\u7684\u91cd\u8981\u6b65\u9a5f\u3002\u901a\u904e\u4f7f\u7528\u9069\u7576\u7684\u51fd\u6578\u548c\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u53bb\u9664\u4e0d\u5fc5\u8981\u7684\u63db\u884c\u7b26\uff0c\u5f9e\u800c\u63d0\u9ad8\u6578\u64da\u7684\u53ef\u7528\u6027\u548c\u4e00\u81f4\u6027\u3002\u7121\u8ad6\u60a8\u4f7f\u7528\u7684\u662fMySQL\u3001PostgreSQL\u9084\u662fSQL Server\uff0c\u4ee5\u4e0a\u63d0\u4f9b\u7684\u65b9\u6cd5\u90fd\u80fd\u5e6b\u52a9\u60a8\u89e3\u6c7a\u63db\u884c\u7b26\u5e36\u4f86\u7684\u554f\u984c\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u7a69\u5b9a\u4e14\u9ad8\u6548\u7684\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u670d\u52d9\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u6578\u64da\u7ba1\u7406\u63d0\u4f9b\u5f37\u5927\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u5728\u6578\u64da\u5eab\u4e2d\u6709\u6548\u904e\u6ffe\u63db\u884c\u7b26\uff0c\u4fdd\u6301\u6578\u64da\u6574\u6f54\uff0c\u907f\u514d\u6df7\u4e82\uff0c\u63d0\u5347\u6578\u64da\u8655\u7406\u6548\u7387\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-179850","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/179850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=179850"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/179850\/revisions"}],"predecessor-version":[{"id":179851,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/179850\/revisions\/179851"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=179850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=179850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=179850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}