{"id":31061,"date":"2024-11-25T15:20:52","date_gmt":"2024-11-25T07:20:52","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31061\/"},"modified":"2024-11-25T15:20:52","modified_gmt":"2024-11-25T07:20:52","slug":"%e8%87%aa%e5%ae%9a%e4%b9%89%e5%be%ae%e4%bf%a1%e7%99%bb%e5%bd%95%e6%89%ab%e7%a0%81%e6%a0%b7%e5%bc%8f%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31061\/","title":{"rendered":"\u81ea\u5b9a\u4e49\u5fae\u4fe1\u767b\u5f55\u626b\u7801\u6837\u5f0f\u89e3\u51b3\u529e\u6cd5"},"content":{"rendered":"<h2><span style=\"font-size: 16px\">PC\u5fae\u4fe1\u626b\u7801\u767b\u5f55<\/span><\/h2>\n<p><span style=\"font-size: 16px\">\u8fd1\u671f\u505a\u4e00\u4e2apc\u7aef\u5fae\u4fe1\u626b\u7801\u767b\u5f55\u7684\u9700\u6c42\uff0c\u5fae\u4fe1\u626b\u7801\u6709\u4e24\u79cd\u65b9\u5f0f\uff0c\u4e00\u79cd\u662f\u65b0\u5f00\u4e00\u4e2a\u4e8c\u7ef4\u7801\u9875\u9762\uff0c\u53e6\u4e00\u79cd\u662f\u5185\u5d4c\u5165\u4ea7\u54c1\u7f51\u9875\u3002\u672c\u6b21\u4ee5\u5185\u5d4c\u4e8c\u7ef4\u7801\u4e3a\u4f8b\uff0c\u5177\u4f53\u600e\u6837\u5728\u9875\u9762\u4e2d\u663e\u793a\u4e00\u4e2a\u767b\u9646\u4e8c\u7ef4\u7801\uff0c\u6587\u6863\u8bf4\u7684\u5f88\u6e05\u695a\uff0c\u5c31\u4e0d\u8d58\u8ff0\u4e86\u3002<\/span><\/p>\n<h2><span style=\"font-size: 16px\">\u89e3\u51b3\u81ea\u5b9a\u4e49\u5fae\u4fe1\u4e8c\u7ef4\u7801\u6837\u5f0f\u95ee\u9898<\/span><\/h2>\n<p><span style=\"font-size: 16px\">\u5f53\u4e00\u5207\u51c6\u5907\u59a5\u5f53\u4e4b\u540e\uff0c\u7f51\u9875\u4e0a\u7684\u4e8c\u7ef4\u7801\u521d\u59cb\u9ed8\u8ba4\u662f\u8fd9\u4e2a\u6837\u5b50\u3002<br \/><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/054\/025\/2230e9d71ab0fc1020231707e7a81cfd-0.png\" class=\"aligncenter\" title=\"\u81ea\u5b9a\u4e49\u5fae\u4fe1\u767b\u5f55\u626b\u7801\u6837\u5f0f\u89e3\u51b3\u529e\u6cd5\u63d2\u56fe\" alt=\"\u81ea\u5b9a\u4e49\u5fae\u4fe1\u767b\u5f55\u626b\u7801\u6837\u5f0f\u89e3\u51b3\u529e\u6cd5\u63d2\u56fe\" \/><\/span><br \/><span style=\"max-width:90%\">\u7279\u522b\u5927\u4e0d\u8bf4\uff08\u9ed8\u8ba4\u4e8c\u7ef4\u7801\u5927\u5c0f280&#215;280\uff09\uff0c\u8fd8\u6709\u5fae\u4fe1\u767b\u5f55\u7684title\uff0c\u4e0b\u65b9\u4e5f\u6709\u626b\u7801\u767b\u5f55\u7684\u63d0\u793a\u3002<br \/>\u5e78\u8fd0\u7684\u662f\uff0c\u5fae\u4fe1\u7559\u4e86\u4e00\u4e2aapi\u7ed9\u6211\u4eec\u81ea\u5b9a\u4e49\u6837\u5f0f\u7684\u673a\u4f1a\uff0c\u5728\u4e4b\u524d\u5b9e\u4f8b\u5316\u4e00\u4e2a\u4e8c\u7ef4\u7801\u7684\u65f6\u5019\uff0c\u5b9e\u4f8b\u5bf9\u8c61\u4e2dhref\u5c5e\u6027\uff0c\u5141\u8bb8\u8bbe\u7f6e\u6837\u5f0f\u3002<\/span><\/p>\n<pre>&lt;span style=\"font-size: 16px;\"&gt; var obj = new WxLogin({&lt;br\/&gt;                        id:\"login_container\", &lt;br\/&gt;                        appid: \"\", &lt;br\/&gt;                        scope: \"\", &lt;br\/&gt;                        redirect_uri: \"\",&lt;br\/&gt;                        state: \"\",&lt;br\/&gt;                        style: \"\",&lt;br\/&gt;                        href: \"..\/qrcode.css\"\/\/\u5c31\u662f\u8fd9\u4e2a\u5c5e\u6027&lt;br\/&gt;                       });&lt;br\/&gt;&lt;\/span&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"font-size: 16px\">\u4e0d\u5e78\u7684\u662f\uff0c\u5728href\u4e2d\u4f20\u5165\u6837\u5f0f\u6587\u4ef6\u7684\u5730\u5740\uff0c\u4f1a\u62a5\u9519\u3002\u8c8c\u4f3c\u5fae\u4fe1\u4e3a\u4e86\u5b89\u5168\u8003\u8651\uff0c\u53ea\u5141\u8bb8\u8bbf\u95eehttps\u7684\u8d44\u6e90\u3002\u4e8e\u662f\u73b0\u5728\u91c7\u7528\u7b2c\u4e8c\u79cd\u89e3\u51b3\u529e\u6cd5data-url\u3002<\/span><\/p>\n<h2><span style=\"font-size: 16px\">\u901a\u8fc7\u8bbf\u95eedata-url\u89e3\u51b3\u6837\u5f0f\u95ee\u9898<\/span><\/h2>\n<p><span style=\"font-size: 16px\">\u5199\u4e00\u4e2anodejs\uff0c\u811a\u672c\u5c06\u521a\u624d\u7684css\u8d44\u6e90\u8f6c\u6362\u4e3adata-url\u3002\u5177\u4f53\u4ee3\u7801\u5b9e\u73b0\u4e3a\uff1a<\/span><\/p>\n<pre>&lt;span style=\"font-size: 16px;\"&gt;var fs = require('fs');&lt;br\/&gt;&lt;br\/&gt;\/\/ function to encode file data to base64 encoded string&lt;br\/&gt;function base64_encode(file) {&lt;br\/&gt;    \/\/ read binary data&lt;br\/&gt;    var bitmap = fs.readFileSync(file);&lt;br\/&gt;    \/\/ convert binary data to base64 encoded string&lt;br\/&gt;    return 'data:text\/css;base64,'+new Buffer(bitmap).toString('base64');&lt;br\/&gt;}&lt;br\/&gt;&lt;br\/&gt;console.log(base64_encode('.\/qrcode.css'))&lt;br\/&gt;&lt;\/span&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"font-size: 16px\">\u8fd0\u884cnode\u811a\u672c\uff0c\u590d\u5236\u6253\u5370\u51fa\u6765\u7684data-url\uff0c\u7136\u540e\u8d4b\u503c\u7ed9\u521a\u624d\u7684href\u3002<br \/><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/054\/025\/cfd86fda8500fa4338e7ed8bf1f19b79-1.png\" class=\"aligncenter\" title=\"\u81ea\u5b9a\u4e49\u5fae\u4fe1\u767b\u5f55\u626b\u7801\u6837\u5f0f\u89e3\u51b3\u529e\u6cd5\u63d2\u56fe1\" alt=\"\u81ea\u5b9a\u4e49\u5fae\u4fe1\u767b\u5f55\u626b\u7801\u6837\u5f0f\u89e3\u51b3\u529e\u6cd5\u63d2\u56fe1\" \/><\/span><\/p>\n<pre>&lt;span   style=\"max-width:90%\"&gt; var obj = new WxLogin({&lt;br\/&gt;                        id:\"login_container\", &lt;br\/&gt;                        appid: \"\", &lt;br\/&gt;                        scope: \"\", &lt;br\/&gt;                        redirect_uri: \"\",&lt;br\/&gt;                        state: \"\",&lt;br\/&gt;                        style: \"\",&lt;br\/&gt;                                           href:\"data:text\/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7d2lkdGg6IDIwMHB4O30NCi5pbXBvd2VyQm94IC50aXRsZSB7ZGlzcGxheTogbm9uZTt9DQouaW1wb3dlckJveCAuaW5mbyB7d2lkdGg6IDIwMHB4O30NCi5zdGF0dXNfaWNvbiB7ZGlzcGxheTpub25lf&lt;br\/&gt;Q0KLmltcG93ZXJCb3ggLnN0YXR1cyB7dGV4dC1hbGlnbjogY2VudGVyO30=\"\/\/data-url&lt;br\/&gt;                       });&lt;br\/&gt;&lt;\/span&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"font-size: 16px\">\u6ce8\u610f\u8fd9\u91cc\u7684MIME\u7c7b\u578b\uff0c\u4e00\u5b9a\u8981\u8fd4\u56detext\/css\u3002<br \/>\u81ea\u5b9a\u4e49\u4e8c\u7ef4\u7801\uff1a<br \/><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/054\/025\/7e6a6ae4ffeb63a7b7b2fc63001ac1a4-2.png\" class=\"aligncenter\" title=\"\u81ea\u5b9a\u4e49\u5fae\u4fe1\u767b\u5f55\u626b\u7801\u6837\u5f0f\u89e3\u51b3\u529e\u6cd5\u63d2\u56fe2\" alt=\"\u81ea\u5b9a\u4e49\u5fae\u4fe1\u767b\u5f55\u626b\u7801\u6837\u5f0f\u89e3\u51b3\u529e\u6cd5\u63d2\u56fe2\" \/><\/span><\/p>\n<p><span style=\"font-size: 16px\">\u76f8\u5173\u6559\u7a0b\uff1a<\/span><\/p>\n<p><span style=\"font-size: 16px\"><\/span><\/p>\n<\/p>\n<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u81ea\u5b9a\u4e49\u5fae\u4fe1\u767b\u5f55\u626b\u7801\u6837\u5f0f\u89e3\u51b3\u529e\u6cd5\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PC\u5fae\u4fe1\u626b\u7801\u767b\u5f55 \u8fd1\u671f\u505a\u4e00\u4e2apc\u7aef\u5fae\u4fe1\u626b\u7801\u767b\u5f55\u7684\u9700\u6c42\uff0c\u5fae\u4fe1\u626b\u7801\u6709\u4e24\u79cd\u65b9\u5f0f\uff0c\u4e00\u79cd\u662f\u65b0\u5f00\u4e00\u4e2a\u4e8c\u7ef4\u7801\u9875\u9762\uff0c\u53e6\u4e00\u79cd\u662f\u5185\u5d4c\u5165\u4ea7\u54c1\u7f51\u9875\u3002\u672c\u6b21\u4ee5\u5185\u5d4c\u4e8c\u7ef4\u7801\u4e3a\u4f8b\uff0c\u5177\u4f53\u600e\u6837\u5728\u9875\u9762\u4e2d\u663e\u793a\u4e00\u4e2a\u767b\u9646\u4e8c\u7ef4\u7801\uff0c\u6587\u6863\u8bf4\u7684\u5f88\u6e05\u695a\uff0c\u5c31\u4e0d\u8d58\u8ff0\u4e86\u3002 \u89e3\u51b3\u81ea\u5b9a\u4e49\u5fae\u4fe1\u4e8c\u7ef4\u7801\u6837\u5f0f\u95ee\u9898 \u5f53\u4e00\u5207\u51c6\u5907\u59a5\u5f53\u4e4b\u540e\uff0c\u7f51\u9875\u4e0a\u7684\u4e8c\u7ef4\u7801\u521d\u59cb\u9ed8\u8ba4\u662f\u8fd9\u4e2a\u6837\u5b50\u3002\u7279\u522b\u5927\u4e0d\u8bf4\uff08\u9ed8\u8ba4\u4e8c\u7ef4\u7801\u5927\u5c0f280&#215;280\uff09\uff0c\u8fd8\u6709\u5fae\u4fe1\u767b\u5f55\u7684title\uff0c\u4e0b\u65b9\u4e5f\u6709\u626b\u7801\u767b\u5f55\u7684\u63d0\u793a\u3002\u5e78\u8fd0\u7684\u662f\uff0c\u5fae\u4fe1\u7559\u4e86\u4e00\u4e2aapi\u7ed9\u6211\u4eec\u81ea\u5b9a\u4e49\u6837\u5f0f\u7684\u673a\u4f1a\uff0c\u5728\u4e4b\u524d\u5b9e\u4f8b\u5316\u4e00\u4e2a\u4e8c\u7ef4\u7801\u7684\u65f6\u5019\uff0c\u5b9e\u4f8b\u5bf9\u8c61\u4e2dhref\u5c5e\u6027\uff0c\u5141\u8bb8\u8bbe\u7f6e\u6837\u5f0f\u3002 &lt;span style=&#8221;font-size: 16px;&#8221;&gt; var obj = new WxLogin({&lt;br\/&gt; id:&#8221;login_container&#8221;, &lt;br\/&gt; appid: &#8220;&#8221;, &lt;br\/&gt; scope: &#8220;&#8221;, &lt;br\/&gt; redirect_uri: &#8220;&#8221;,&lt;br\/&gt; state: &#8220;&#8221;,&lt;br\/&gt; style: &#8220;&#8221;,&lt;br\/&gt; href: &#8220;..\/qrcode.css&#8221;\/\/\u5c31\u662f\u8fd9\u4e2a\u5c5e\u6027&lt;br\/&gt; });&lt;br\/&gt;&lt;\/span&gt; \u767b\u5f55\u540e\u590d\u5236 \u4e0d\u5e78\u7684\u662f\uff0c\u5728href\u4e2d\u4f20\u5165\u6837\u5f0f\u6587\u4ef6\u7684\u5730\u5740\uff0c\u4f1a\u62a5\u9519\u3002\u8c8c\u4f3c\u5fae\u4fe1\u4e3a\u4e86\u5b89\u5168\u8003\u8651\uff0c\u53ea\u5141\u8bb8\u8bbf\u95eehttps\u7684\u8d44\u6e90\u3002\u4e8e\u662f\u73b0\u5728\u91c7\u7528\u7b2c\u4e8c\u79cd\u89e3\u51b3\u529e\u6cd5data-url\u3002 \u901a\u8fc7\u8bbf\u95eedata-url\u89e3\u51b3\u6837\u5f0f\u95ee\u9898 \u5199\u4e00\u4e2anodejs\uff0c\u811a\u672c\u5c06\u521a\u624d\u7684css\u8d44\u6e90\u8f6c\u6362\u4e3adata-url\u3002\u5177\u4f53\u4ee3\u7801\u5b9e\u73b0\u4e3a\uff1a &lt;span style=&#8221;font-size: 16px;&#8221;&gt;var fs = require(&#8216;fs&#8217;);&lt;br\/&gt;&lt;br\/&gt;\/\/ function to encode file data to base64 encoded string&lt;br\/&gt;function base64_encode(file) {&lt;br\/&gt; \/\/ read binary data&lt;br\/&gt; var [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-31061","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31061","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=31061"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31061\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}