{"id":196229,"date":"2024-11-13T21:33:24","date_gmt":"2024-11-13T13:33:24","guid":{"rendered":"https:\/\/server.hk\/cnblog\/196229\/"},"modified":"2024-11-13T21:33:25","modified_gmt":"2024-11-13T13:33:25","slug":"%e6%8e%8c%e6%8f%a1%e6%95%b8%e6%93%9a%e5%ba%ab%e5%ad%97%e7%ac%a6%e9%95%b7%e5%ba%a6%e5%87%bd%e6%95%b8%ef%bc%8c%e8%ae%93%e4%bd%a0%e8%bc%95%e9%ac%86%e6%93%8d%e4%bd%9c%e5%a4%a7%e6%95%b8%e6%93%9a%ef%bc%81","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/196229\/","title":{"rendered":"\u638c\u63e1\u6578\u64da\u5eab\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\uff0c\u8b93\u4f60\u8f15\u9b06\u64cd\u4f5c\u5927\u6578\u64da\uff01 (\u6578\u64da\u5eab\u5b57\u7b26\u9577\u5ea6\u51fd\u6578)"},"content":{"rendered":"<h1 id=\"%e6%8e%8c%e6%8f%a1%e6%95%b8%e6%93%9a%e5%ba%ab%e5%ad%97%e7%ac%a6%e9%95%b7%e5%ba%a6%e5%87%bd%e6%95%b8%ef%bc%8c%e8%ae%93%e4%bd%a0%e8%bc%95%e9%ac%86%e6%93%8d%e4%bd%9c%e5%a4%a7%e6%95%b8%e6%93%9a%ef%bc%81-PyOBUvAApY\">\u638c\u63e1\u6578\u64da\u5eab\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\uff0c\u8b93\u4f60\u8f15\u9b06\u64cd\u4f5c\u5927\u6578\u64da\uff01<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u7ba1\u7406\u548c\u64cd\u4f5c\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u91cd\u8981\u3002\u7279\u5225\u662f\u5728\u8655\u7406\u5927\u6578\u64da\u6642\uff0c\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u7684\u4f7f\u7528\u53ef\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u548c\u6578\u64da\u5206\u6790\u5e2b\u66f4\u6709\u6548\u5730\u7ba1\u7406\u548c\u64cd\u4f5c\u6578\u64da\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u6578\u64da\u5eab\u4e2d\u7684\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u5be6\u7528\u7684\u793a\u4f8b\u548c\u4ee3\u78bc\u7247\u6bb5\uff0c\u5e6b\u52a9\u8b80\u8005\u66f4\u597d\u5730\u7406\u89e3\u9019\u4e00\u6982\u5ff5\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e5%ad%97%e7%ac%a6%e9%95%b7%e5%ba%a6%e5%87%bd%e6%95%b8%ef%bc%9f-PyOBUvAApY\">\u4ec0\u9ebc\u662f\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\uff1f<\/h2>\n<p>\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u662f\u4e00\u7a2e\u7528\u65bc\u8a08\u7b97\u5b57\u7b26\u4e32\u4e2d\u5b57\u7b26\u6578\u91cf\u7684\u51fd\u6578\u3002\u9019\u5728\u6578\u64da\u5eab\u64cd\u4f5c\u4e2d\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u70ba\u5b83\u53ef\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u78ba\u5b9a\u5b57\u6bb5\u7684\u5927\u5c0f\u3001\u9a57\u8b49\u6578\u64da\u7684\u5b8c\u6574\u6027\u4ee5\u53ca\u9032\u884c\u6578\u64da\u6e05\u7406\u7b49\u3002\u4e0d\u540c\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u63d0\u4f9b\u4e86\u4e0d\u540c\u7684\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\uff0c\u6700\u5e38\u898b\u7684\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><code>LENGTH()<\/code>\uff1a\u8a08\u7b97\u5b57\u7b26\u4e32\u7684\u5b57\u7bc0\u9577\u5ea6\u3002<\/li>\n<li><code>CHAR_LENGTH()<\/code>\u6216<code>CHARACTER_LENGTH()<\/code>\uff1a\u8a08\u7b97\u5b57\u7b26\u4e32\u7684\u5b57\u7b26\u6578\u91cf\u3002<\/li>\n<li><code>LEN()<\/code>\uff1a\u5728\u67d0\u4e9b\u6578\u64da\u5eab\u4e2d\uff08\u5982 SQL Server\uff09\u4f7f\u7528\u7684\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%ad%97%e7%ac%a6%e9%95%b7%e5%ba%a6%e5%87%bd%e6%95%b8%e7%9a%84%e4%bd%bf%e7%94%a8%e7%a4%ba%e4%be%8b-PyOBUvAApY\">\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u7684\u4f7f\u7528\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u6578\u64da\u5eab\u7cfb\u7d71\u4e2d\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u7684\u4f7f\u7528\u793a\u4f8b\uff1a<\/p>\n<h3 id=\"mysql-PyOBUvAApY\">MySQL<\/h3>\n<pre><code>SELECT LENGTH('Hello, World!') AS byte_length, CHAR_LENGTH('Hello, World!') AS char_length;<\/code><\/pre>\n<p>\u5728\u9019\u500b\u4f8b\u5b50\u4e2d\uff0c<code>LENGTH()<\/code> \u51fd\u6578\u8fd4\u56de\u5b57\u7b26\u4e32\u7684\u5b57\u7bc0\u9577\u5ea6\uff0c\u800c <code>CHAR_LENGTH()<\/code> \u8fd4\u56de\u5b57\u7b26\u6578\u91cf\u3002\u5c0d\u65bc ASCII \u5b57\u7b26\uff0c\u5169\u8005\u7684\u7d50\u679c\u76f8\u540c\uff0c\u4f46\u5c0d\u65bc\u591a\u5b57\u7bc0\u5b57\u7b26\uff08\u5982\u4e2d\u6587\uff09\uff0c\u7d50\u679c\u53ef\u80fd\u6703\u6709\u6240\u4e0d\u540c\u3002<\/p>\n<h3 id=\"postgresql-PyOBUvAApY\">PostgreSQL<\/h3>\n<pre><code>SELECT LENGTH('\u4f60\u597d\uff0c\u4e16\u754c\uff01') AS byte_length, CHAR_LENGTH('\u4f60\u597d\uff0c\u4e16\u754c\uff01') AS char_length;<\/code><\/pre>\n<p>\u5728 PostgreSQL \u4e2d\uff0c\u4f7f\u7528 <code>LENGTH()<\/code> \u548c <code>CHAR_LENGTH()<\/code> \u7684\u65b9\u5f0f\u8207 MySQL \u985e\u4f3c\u3002\u9019\u4f7f\u5f97\u958b\u767c\u8005\u53ef\u4ee5\u8f15\u9b06\u5730\u7372\u53d6\u5b57\u7b26\u4e32\u7684\u5b57\u7bc0\u548c\u5b57\u7b26\u9577\u5ea6\u3002<\/p>\n<h3 id=\"sql-server-PyOBUvAApY\">SQL Server<\/h3>\n<pre><code>SELECT LEN('Hello, World!') AS char_length;<\/code><\/pre>\n<p>\u5728 SQL Server \u4e2d\uff0c<code>LEN()<\/code> \u51fd\u6578\u7528\u65bc\u8a08\u7b97\u5b57\u7b26\u4e32\u7684\u5b57\u7b26\u6578\u91cf\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c<code>LEN()<\/code> \u4e0d\u6703\u8a08\u7b97\u5c3e\u96a8\u7a7a\u683c\u3002<\/p>\n<h2 id=\"%e5%ad%97%e7%ac%a6%e9%95%b7%e5%ba%a6%e5%87%bd%e6%95%b8%e7%9a%84%e6%87%89%e7%94%a8%e5%a0%b4%e6%99%af-PyOBUvAApY\">\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u7684\u61c9\u7528\u5834\u666f<\/h2>\n<p>\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u5728\u591a\u500b\u5834\u666f\u4e2d\u90fd\u975e\u5e38\u6709\u7528\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u9a57\u8b49\uff1a<\/strong>\u5728\u63d2\u5165\u6216\u66f4\u65b0\u6578\u64da\u6642\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u4f86\u78ba\u4fdd\u6578\u64da\u7b26\u5408\u9810\u671f\u7684\u683c\u5f0f\u548c\u9577\u5ea6\u3002<\/li>\n<li><strong>\u6578\u64da\u6e05\u7406\uff1a<\/strong>\u5728\u8655\u7406\u4e0d\u898f\u5247\u6578\u64da\u6642\uff0c\u53ef\u4ee5\u901a\u904e\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u4f86\u8b58\u5225\u548c\u522a\u9664\u4e0d\u5fc5\u8981\u7684\u6578\u64da\u3002<\/li>\n<li><strong>\u5831\u544a\u751f\u6210\uff1a<\/strong>\u5728\u751f\u6210\u5831\u544a\u6642\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u4f86\u8a08\u7b97\u5b57\u6bb5\u7684\u9577\u5ea6\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u683c\u5f0f\u5316\u8f38\u51fa\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-PyOBUvAApY\">\u7e3d\u7d50<\/h2>\n<p>\u638c\u63e1\u6578\u64da\u5eab\u4e2d\u7684\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u5c0d\u65bc\u6709\u6548\u7ba1\u7406\u548c\u64cd\u4f5c\u5927\u6578\u64da\u81f3\u95dc\u91cd\u8981\u3002\u901a\u904e\u4e86\u89e3\u4e0d\u540c\u6578\u64da\u5eab\u7cfb\u7d71\u4e2d\u7684\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\u53ca\u5176\u61c9\u7528\uff0c\u958b\u767c\u8005\u548c\u6578\u64da\u5206\u6790\u5e2b\u53ef\u4ee5\u66f4\u8f15\u9b06\u5730\u8655\u7406\u6578\u64da\uff0c\u78ba\u4fdd\u6578\u64da\u7684\u5b8c\u6574\u6027\u548c\u6e96\u78ba\u6027\u3002\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4f86\u652f\u6301\u60a8\u7684\u6578\u64da\u5eab\u64cd\u4f5c\uff0cServer.HK \u63d0\u4f9b\u4e86\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6236\u3002\u7121\u8ad6\u662f <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u9084\u662f\u5176\u4ed6\u670d\u52d9\uff0c\u60a8\u90fd\u53ef\u4ee5\u5728\u6211\u5011\u7684\u7db2\u7ad9\u4e0a\u627e\u5230\u5408\u9069\u7684\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u638c\u63e1\u6578\u64da\u5eab\u5b57\u7b26\u9577\u5ea6\u51fd\u6578\uff0c\u8f15\u9b06\u8a08\u7b97\u548c\u7ba1\u7406\u5927\u6578\u64da\u4e2d\u7684\u5b57\u7b26\u9577\u5ea6\uff0c\u63d0\u5347\u6578\u64da\u8655\u7406\u6548\u7387\uff01<\/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-196229","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/196229","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=196229"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/196229\/revisions"}],"predecessor-version":[{"id":196230,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/196229\/revisions\/196230"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=196229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=196229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=196229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}