标签作用及使用方法详解

时间:2025-08-03

浏览:343

作者:佚名

今天golang学习网给大家带来了《

标签的作用是告诉浏览器将页面中的所有内容作为纯文本显示,忽略其中的 HTML 标签和格式。也就是说,浏览器不会对 <plaintext> 标签内的内容进行解析,而是直接以原始文本形式展示。示例:<plaintext> <h1>这是一段标题</h1> <p>这是一段段落。</p> </plaintext>显示效果:<h1>这是一段标题</h1> <p>这是一段段落。</p>注意事项:<plaintext> 标签在现代 HTML 中已经不推荐使用,因为它会影响页面的结构和可访问性。该标签在 HTML5 中已被移除,因此在新项目中应避免使用。如果需要嵌入纯文本内容,可以使用 <pre> 或 <code> 标签,并结合 CSS 杦制样式来达到类似效果。纯文本如何嵌入?如果你希望在网页中插入纯文本(即不带任何 HTML 格式的内容),可以使用以下方法:方法一:使用 <pre> 标签<pre> 这是 一段 纯文本 内容。 </pre>方法二:使用 <code> 标签 <code> 这是 一段 代码 或文本 内容。 </code》</span>,其中涉及到的知识点包括<span style="color: #FF6600; font-family: &quot;Source Sans Pro&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 14px; background-color: #FFFFFF;"></span>等等,无论你是小白还是老手,都适合看一看哦~有好的建议也欢迎大家在评论留言,若是看完有所收获,也希望大家能多多点赞支持呀!一起加油学习~</p><p>现代网页开发中不推荐使用&lt;plaintext&gt;标签,因为它存在严重的安全漏洞,一旦被用户输入触发,会导致后续所有HTML内容被当作纯文本显示,破坏页面结构并可能引发XSS攻击;2. 它完全不可控,无法在其中使用任何HTML标签、CSS样式或JavaScript,丧失了现代Web的交互性和表现力;3. 浏览器兼容性差,不同浏览器对其解析不一致,难以保证跨平台一致性;4. 更安全有效的替代方案包括使用&lt;pre&gt;和&lt;code&gt;标签组合来语义化展示预格式化文本或代码片段;5. 通过HTML实体编码(如&amp;lt;代替&lt;)确保特殊字符不被解析为HTML标签;6. 利用CSS的white-space属性(如pre、pre-wrap、pre-line)控制空白符和换行符的处理方式;7. 在动态内容中嵌入纯文本时,必须对用户输入进行HTML实体编码,优先使用textContent而非innerHTML操作DOM;8. 结合内容安全策略(CSP)增强整体安全性,防止恶意脚本执行;9. 对于富文本需求,应采用白名单过滤(如DOMPurify)或使用Markdown等标记语言转换,确保输出安全。这些方法共同构建了一个安全、可控、语义清晰的纯文本展示机制,取代了已被废弃的&lt;plaintext&gt;标签。</p><p><img src="https://img.17golang.com/uploads/20250803/1754195652688ee6c4be8c9.png" alt="plaintext标签的作用?纯文本如何嵌入?"></p><p>在现代网页开发中,如果你想让一段文本“原样”显示,不被浏览器解析成HTML标签,或者保留它所有的空格和换行符,那通常不是通过一个叫做“plaintext标签”来实现的。虽然历史上确实有过一个 <code>&lt;plaintext&gt;</code> 标签,但它早已被废弃,并且充满了各种问题。现在,我们主要依赖像 <code>&lt;pre&gt;</code> 和 <code>&lt;code&gt;</code> 这样的语义化标签,结合HTML实体编码和CSS样式来达成“纯文本”的展示效果。核心思想就是告诉浏览器:“嘿,别自作聪明,把这段内容老老实实地给我显示出来,一个字符都别动。”</p><img src="https://img.17golang.com/uploads/20250803/1754195652688ee6c4c2c42.png" alt="plaintext标签的作用?纯文本如何嵌入?" /><h2>解决方案</h2><p>说实话,每次提到“纯文本嵌入”,我脑子里首先浮现的不是某个神奇的标签,而是如何确保浏览器别“过度解读”我的内容。那个古老的<code>&lt;plaintext&gt;</code>标签,它确实曾经存在,设计初衷就是把从它开始到文档末尾的所有内容都当成纯文本处理。听起来很美好对不对?但实际操作起来,它简直是个噩梦:安全性差,不可控,而且浏览器行为还可能不一致。所以,忘掉它吧,它已经被历史淘汰了。</p><p>现在,我们要嵌入纯文本,特别是代码片段或者需要保留格式的文本,有几种更健壮、更标准的方法:</p><img src="https://img.17golang.com/uploads/20250803/1754195652688ee6c4c63a8.png" alt="plaintext标签的作用?纯文本如何嵌入?" /><ol><li><p><strong><code>&lt;pre&gt;</code> 标签:</strong> 这是最常用也最直接的。<code>pre</code> 是 "preformatted text" 的缩写。它会保留文本中的空格和换行符,并通常以等宽字体显示。这对于展示代码、诗歌或者任何需要精确格式的文本都非常有用。</p><pre class='brush:language-html;toolbar:false;'>&lt;pre&gt; function helloWorld() { console.log("Hello, World!"); } // 看,这里的缩进和换行都被保留了! &lt;/pre&gt;</pre></li><li><p><strong><code>&lt;code&gt;</code> 标签:</strong> 这个标签是用来表示计算机代码的。它本身不保留格式(默认不保留空格和换行),但通常会以等宽字体显示。所以,你经常会看到它和 <code>&lt;pre&gt;</code> 标签一起使用,形成 <code>&lt;pre&gt;&lt;code&gt;...&lt;/code&gt;&lt;/pre&gt;</code> 的结构,既语义化地表示代码,又保留了代码的格式。</p><img src="https://img.17golang.com/uploads/20250803/1754195652688ee6c4c9839.png" alt="plaintext标签的作用?纯文本如何嵌入?" /><pre class='brush:language-html;toolbar:false;'>&lt;pre&gt;&lt;code&gt; // 这是一个简单的Python函数 def greet(name): return f"Hello, {name}!" &lt;/code&gt;&lt;/pre&gt;</pre></li><li><p><strong>HTML 实体编码:</strong> 如果你真的想在普通文本流中显示像 <code>&lt;</code>、<code>&gt;</code>、<code>&amp;</code> 这样的特殊HTML字符,而不是让它们被解析成标签,你就需要使用它们的HTML实体编码。比如 <code>&amp;lt;</code> 表示 <code>&lt;</code>,<code>&amp;gt;</code> 表示 <code>&gt;</code>, <code>&amp;amp;</code> 表示 <code>&amp;</code>。这对于在段落中提及HTML标签名非常有用。</p><pre class='brush:language-html;toolbar:false;'>&lt;p&gt;在HTML中,我们使用 &amp;lt;p&amp;gt; 标签来定义一个段落。&lt;/p&gt;</pre></li><li><p><strong>CSS <code>white-space</code> 属性:</strong> 某些情况下,你可能不想用 <code>&lt;pre&gt;</code>,但又想控制文本的空白符处理。<code>white-space</code> CSS 属性可以派上用场。</p><ul><li><code>white-space: pre;</code> 效果类似 <code>&lt;pre&gt;</code>。</li><li><code>white-space: pre-wrap;</code> 保留空白符和换行,但会在必要时自动换行。</li><li><code>white-space: nowrap;</code> 不换行。</li><li><code>white-space: pre-line;</code> 合并空白符,但保留换行。</li></ul><pre class='brush:language-html;toolbar:false;'>&lt;div style="white-space: pre-wrap; border: 1px solid #ccc; padding: 10px;"&gt; 这是 一段 有 很多 不规则 空白和换行的文本。 它应该会按原样显示,但会自动换行。 &lt;/div&gt;</pre></li></ol><p>这些方法各有侧重,但核心都是为了确保文本的“纯粹性”不被HTML解析器干扰。</p><h3>为什么现代网页开发中不推荐使用<code>&lt;plaintext&gt;</code>标签?</h3><p>嗯,这个问题问得好,因为它触及了Web发展中一个很重要的原则:安全与可控性。那个老旧的<code>&lt;plaintext&gt;</code>标签,它被废弃真不是没有原因的。</p><p>首先,<strong>安全性是个大问题</strong>。想想看,一旦浏览器遇到<code>&lt;plaintext&gt;</code>,它就会停止解析HTML,把之后的所有内容都当成纯文本直到文档末尾。这意味着什么?如果你的网页内容是动态生成的,或者包含了用户输入,一旦用户输入了<code>&lt;plaintext&gt;</code>,那么你后续所有的HTML结构、脚本、样式表都可能被“吞掉”,变成一堆无用的纯文本。这简直是为跨站脚本攻击(XSS)敞开了大门。攻击者可以轻易地破坏你的页面布局,甚至隐藏恶意代码。你根本无法控制它什么时候结束。</p><p>其次,<strong>它完全不可控</strong>。你不能在<code>&lt;plaintext&gt;</code>内部使用任何HTML标签,也不能应用CSS样式,更别提JavaScript了。它就像一个黑洞,吞噬了一切HTML的语义和表现力。这在现代Web开发中是完全不可接受的,我们追求的是语义化、可访问性和精细的控制。</p><p>最后,<strong>浏览器兼容性一塌糊涂</strong>。由于它被废弃了,不同的浏览器对它的处理方式可能五花八门,你根本无法保证它在所有用户那里都能按你预想的“纯文本”方式工作。这对于追求一致用户体验的开发者来说,简直是灾难。</p><p>所以,与其纠结一个已经被淘汰的、有安全隐患的标签,不如拥抱那些成熟、标准、可控的替代方案。这不光是为了代码的优雅,更是为了用户的安全和网站的健壮。</p><h3>除了<code>&lt;pre&gt;</code>和<code>&lt;code&gt;</code>,还有哪些方法可以确保文本按原样显示?</h3><p>除了我们常用的<code>&lt;pre&gt;</code>和<code>&lt;code&gt;</code>组合,以及前面提到的一些CSS技巧,其实还有一些更底层的思路和场景,能帮助我们确保文本的“原样”性。这不仅仅是关于标签,更多的是关于数据流和解析的理解。</p><p>一个很重要的概念是<strong>HTML实体编码的全面性</strong>。我们前面提到了<code>&amp;lt;</code>和<code>&amp;gt;</code>这些,但实际上,所有可能被HTML解析器误读的字符,都应该被正确地编码。这包括<code>&amp;</code>(<code>&amp;amp;</code>)、<code>"</code>(<code>&amp;quot;</code>)、<code>'</code>(<code>&amp;#39;</code> 或 <code>&amp;apos;</code>,尽管<code>&amp;apos;</code>在HTML5中才正式支持,通常用<code>&amp;#39;</code>更保险),以及一些特殊字符如非断行空格<code>&amp;nbsp;</code>等。当你在普通HTML元素(如<code>&lt;p&gt;</code>、<code>&lt;span&gt;</code>)中显示用户输入或从数据库取出的文本时,如果这些文本可能包含HTML标签,那么在将其插入到DOM之前,进行全面的HTML实体编码是必不可少的步骤。这通常在服务器端完成,或者在客户端使用JavaScript的特定方法。</p><p>再者,对于那些不仅仅是代码,而是需要保留所有格式(包括多个连续空格和换行符)的普通文本,但又不想用等宽字体或<code>&lt;pre&gt;</code>的默认样式时,<strong>CSS <code>white-space</code> 属性</strong>就显得尤为关键。比如 <code>white-space: pre-wrap;</code> 是一个非常实用的选择。它会保留文本中的所有空白符和换行符,同时允许文本在需要时自动换行,这比<code>pre</code>的严格不换行要灵活得多,尤其适合展示用户输入的日志、长段落描述等。</p><pre class='brush:language-html;toolbar:false;'>&lt;div class="log-output"&gt; 这是一个多行文本的输出, 它里面包含了 一些 不规则的 空格和换行。 &lt;/div&gt; &lt;style&gt; .log-output { white-space: pre-wrap; /* 保留所有空白和换行,但允许自动换行 */ font-family: sans-serif; /* 不一定是等宽字体 */ border: 1px dashed #ccc; padding: 10px; margin-top: 15px; } &lt;/style&gt;</pre><p>此外,在某些前端框架或模板引擎中,它们通常会提供<strong>自动转义</strong>的功能。例如,在React中,如果你把一个字符串直接放在JSX中,它会自动进行HTML实体编码。Vue和Angular也有类似的安全机制。这意味着你通常不需要手动去写<code>&amp;lt;</code>,框架会帮你处理。但如果你需要动态插入HTML(例如,从富文本编辑器来的内容),你必须明确告诉框架你信任这段HTML,比如React的<code>dangerouslySetInnerHTML</code>,这时候你就要自己确保内容的安全性了。</p><p>最后,一个比较偏但有时有用的思路是,将纯文本作为<strong>外部资源</strong>加载。比如,通过AJAX请求一个 <code>.txt</code> 文件,然后将其内容直接放入一个<code>&lt;pre&gt;</code>标签或者一个设置了<code>white-space: pre-wrap;</code>的<code>div</code>中。这种方式天然地保证了内容的纯文本性,因为浏览器不会尝试将<code>.txt</code>文件的内容解析为HTML。</p><h3>在动态内容或用户输入中,如何安全有效地嵌入纯文本?</h3><p>处理动态内容,尤其是用户输入,是Web开发中一个非常核心且充满挑战的环节。这里的“安全”和“有效”是同等重要的。如果处理不当,不仅会显示错乱,更可能引入严重的安全漏洞,比如跨站脚本攻击(XSS)。</p><p>核心原则是:<strong>永远不要相信用户输入。</strong> 任何来自用户或外部系统的数据,在将其显示到网页上之前,都必须进行适当的处理。</p><ol><li><p><strong>HTML 实体编码(Escape)是第一道防线:</strong> 这是最基本也是最重要的一步。当你从数据库、API或者用户表单中获取到一段文本,并打算把它放到HTML页面中时,你必须对其中所有可能被浏览器解析为HTML标签或特殊字符的内容进行编码。 例如,如果用户输入了 <code>&lt;script&gt;alert('XSS')&lt;/script&gt;</code>,如果你直接把它放到HTML里,浏览器就会执行这个脚本。但如果经过HTML实体编码,它就会变成 <code>&amp;lt;script&amp;gt;alert(&amp;#39;XSS&amp;#39;)&amp;lt;/script&amp;gt;</code>,浏览器会把它当作普通文本显示出来,而不是执行脚本。 这通常在<strong>服务器端</strong>完成,使用编程语言提供的安全函数。比如:</p><ul><li>Python: <code>html.escape()</code></li><li>PHP: <code>htmlspecialchars()</code></li><li>Node.js: 许多模板引擎(如EJS, Pug)默认会转义,或者使用像 <code>lodash.escape</code> 这样的库。 在<strong>客户端</strong>(JavaScript)插入文本时,使用 <code>textContent</code> 而非 <code>innerHTML</code> 是最佳实践。</li></ul><pre class='brush:language-javascript;toolbar:false;'>const userInput = "&lt;img src=x onerror=alert('XSS')&gt;"; const divElement = document.getElementById('output'); // 安全的做法:textContent 会自动将特殊字符转义 divElement.textContent = userInput; // 显示 "&lt;img src=x onerror=alert('XSS')&gt;" // 危险的做法:innerHTML 会解析并执行HTML // divElement.innerHTML = userInput; // 会尝试加载图片,并执行alert</pre></li><li><p><strong>内容安全策略(Content Security Policy, CSP):</strong> CSP 是一种额外的安全层,通过设置HTTP响应头,告诉浏览器哪些资源可以加载和执行。它可以限制脚本的来源、样式表的来源等,即使发生了XSS,也能在一定程度上限制其破坏力。虽然它不能直接“嵌入纯文本”,但它从宏观上增强了Web应用的安全性,让开发者在处理动态内容时更有信心。</p></li><li><p><strong>富文本处理的特殊考量:</strong> 如果你的应用允许用户输入富文本(比如带有加粗、斜体、链接等格式的内容),那么仅仅进行HTML实体编码是不够的,因为它会把所有格式都编码掉。这时候你需要:</p><ul><li><strong>白名单过滤(Sanitization):</strong> 使用专门的库(如 DOMPurify 在前端,或者服务器端的类似库)来解析用户输入的HTML,只允许安全的标签和属性通过,移除所有潜在的恶意内容(如<code>script</code>标签、<code>on*</code>事件属性等)。这比简单的转义复杂得多,但对于富文本是必须的。</li><li><strong>Markdown 或其他轻量级标记语言:</strong> 鼓励用户使用Markdown等标记语言输入内容,然后在后端或前端将其转换为HTML。这种方式的好处是,你对生成HTML的过程有完全的控制,可以确保只生成安全的HTML。</li></ul></li></ol><p>总结来说,安全有效地嵌入动态纯文本,是一个多层次的防御体系。从源头(用户输入)开始,到服务器端处理,再到客户端渲染,每一步都需要考虑文本的“纯粹性”和潜在的威胁。这不仅仅是技术细节,更是一种安全意识的体现。</p><p>今天带大家了解了的相关知识,希望对你有所帮助;关于文章的技术知识我们会一点点深入介绍,欢迎大家关注golang学习网公众号,一起学习编程~</p> <p class="warings">本文内容来源于互联网,如有侵权请联系删除。</p> </div> <div class="artmoretabs flexRow"> <div class="mtbs flexRow"> </div> </div> <div class="lastanext flexColumn"> <a class="lastart flexRow" href="/article/273937.html" title="Go语言Channel队列与并发技巧"><span>上一篇:</span><span>Go语言Channel队列与并发技巧</span></a> <a class="nextart flexRow" href="/article/273939.html" title="Golangembed包使用教程:管理前端资源依赖"><span>下一篇:</span><span>Golangembed包使用教程:管理前端资源依赖</span></a> </div> </div> <div class="authormore comlists"> <div class="jb-titles flexRow"> <div class="jbtle-left flexRow"><b></b> <p>相关文章</p><b></b> </div> <a class="jbtitle-more flexRow" href="/articlelist/88_new_0_1.html" title="更多"><span>更多</span><b></b></a> </div> <div class="swiper xgartswiper index"> <div class="swiper-wrapper"> <div class="swiper-slide flexcolumn weekslide"> <ul class="authlists "> <li class="authlist-card "> <div class="authcard-link"> <a href="/article/593761.html" title="ShadowDOM如何实现样式隔离与结构保护" class="authcard-title"><span class="scothtopp">ShadowDOM如何实现样式隔离与结构保护</span></a> <p class="authcard-desc overflowclass">ShadowDOM通过影子边界实现样式与结构硬隔离:选open模式便于调试;样式须注入shadowRoot,禁用全局CSS;用:host和::slotted精准控制穿透;DOM查询天然受限,但JS环境仍共享。</p> <div class="authcard-meta flexRow"> <span class="authmeta-item authmeta-time flexRow"><b></b>2026.05.09</span> <span class="authmeta-item authmeta-view flexRow"><b></b>304</span> <span class="authmeta-item authmeta-author flexRow"><b></b>会飞的鱼</span> <a href="/articlelist/88_new_0_1.html" title="前端" class="authmeta-item authmeta-type flexRow"><b></b>前端</a> </div> </div> </li> <li class="authlist-card "> <div class="authcard-link"> <a href="/article/593756.html" title="HTML如何布局大型网站内容" class="authcard-title"><span class="scothtopp">HTML如何布局大型网站内容</span></a> <p class="authcard-desc overflowclass">大型网站必须拆分HTML文件:纯静态MPA需按模块拆为多页并统一管理公共结构;SPA则用index.html作壳,由React/Vue等框架接管路由与渲染。</p> <div class="authcard-meta flexRow"> <span class="authmeta-item authmeta-time flexRow"><b></b>2026.05.09</span> <span class="authmeta-item authmeta-view flexRow"><b></b>449</span> <span class="authmeta-item authmeta-author flexRow"><b></b>会飞的鱼</span> <a href="/articlelist/88_new_0_1.html" title="前端" class="authmeta-item authmeta-type flexRow"><b></b>前端</a> </div> </div> </li> <li class="authlist-card "> <div class="authcard-link"> <a href="/article/593754.html" title="JS生成JSON导出为本地文件方法" class="authcard-title"><span class="scothtopp">JS生成JSON导出为本地文件方法</span></a> <p class="authcard-desc overflowclass">Chrome/Edgev110+禁止非用户手势触发的data:URL自动下载,Firefox行为不一致;正确做法是JSON→Blob→URL.createObjectURL→click,需指定type、及时revoke、确保用户手势触发。</p> <div class="authcard-meta flexRow"> <span class="authmeta-item authmeta-time flexRow"><b></b>2026.05.09</span> <span class="authmeta-item authmeta-view flexRow"><b></b>130</span> <span class="authmeta-item authmeta-author flexRow"><b></b>会飞的鱼</span> <a href="/articlelist/88_new_0_1.html" title="前端" class="authmeta-item authmeta-type flexRow"><b></b>前端</a> </div> </div> </li> </ul> </div> <div class="swiper-slide flexcolumn weekslide"> <ul class="authlists "> <li class="authlist-card "> <div class="authcard-link"> <a href="/article/593753.html" title="JavaScript秒级倒计时代码实现" class="authcard-title"><span class="scothtopp">JavaScript秒级倒计时代码实现</span></a> <p class="authcard-desc overflowclass">JavaScript倒计时应基于目标时间动态计算差值,用setInterval每秒更新并格式化输出;页面失焦时监听visibilitychange事件重算,确保秒级精准。</p> <div class="authcard-meta flexRow"> <span class="authmeta-item authmeta-time flexRow"><b></b>2026.05.09</span> <span class="authmeta-item authmeta-view flexRow"><b></b>109</span> <span class="authmeta-item authmeta-author flexRow"><b></b>会飞的鱼</span> <a href="/articlelist/88_new_0_1.html" title="前端" class="authmeta-item authmeta-type flexRow"><b></b>前端</a> </div> </div> </li> <li class="authlist-card "> <div class="authcard-link"> <a href="/article/452701.html" title="HTML/CSS登录表单验证技巧" class="authcard-title"><span class="scothtopp">HTML/CSS登录表单验证技巧</span></a> <p class="authcard-desc overflowclass">仅靠HTML的required属性或CSS伪类(如:invalid)无法实现“两个字段中至少一个必填”的逻辑约束,该需求必须借助JavaScript完成客户端校验。</p> <div class="authcard-meta flexRow"> <span class="authmeta-item authmeta-time flexRow"><b></b>2026.01.10</span> <span class="authmeta-item authmeta-view flexRow"><b></b>481</span> <span class="authmeta-item authmeta-author flexRow"><b></b>会飞的鱼</span> <a href="/articlelist/88_new_0_1.html" title="前端" class="authmeta-item authmeta-type flexRow"><b></b>前端</a> </div> </div> </li> <li class="authlist-card "> <div class="authcard-link"> <a href="/article/452684.html" title="JavaScript如何操作Cookie?现在还值得用吗?" class="authcard-title"><span class="scothtopp">JavaScript如何操作Cookie?现在还值得用吗?</span></a> <p class="authcard-desc overflowclass">Cookie未被废弃但用途收窄,仅适用于同源、小体积、需服务端参与的会话标识;因是分号分隔字符串协议,读写需手动解析转义,易出错且易触发安全策略。</p> <div class="authcard-meta flexRow"> <span class="authmeta-item authmeta-time flexRow"><b></b>2026.01.10</span> <span class="authmeta-item authmeta-view flexRow"><b></b>274</span> <span class="authmeta-item authmeta-author flexRow"><b></b>会飞的鱼</span> <a href="/articlelist/88_new_0_1.html" title="前端" class="authmeta-item authmeta-type flexRow"><b></b>前端</a> </div> </div> </li> </ul> </div> </div> </div> <div class="swiper-pagination xgartswiper-pagination"></div> <script> var mySwiper = new Swiper('.xgartswiper', { autoplay: false, pagination: { el: '.xgartswiper-pagination', clickable: true, }, spaceBetween: 20 }) </script> </div> <div class="cdr-weekchoose comlists"> <div class="jb-titles flexRow"> <div class="jbtle-left flexRow"><b></b> <p>近期热门</p><b></b> </div> <a class="jbtitle-more flexRow" href="/articlelist.html" title="更多"><span>更多</span><b></b></a> </div> <div class="weekch-list"> </div> </div> <div class="cdr-hot comlists"> <div class="jb-titles flexRow"> <div class="jbtle-left flexRow"><b></b> <p>站内热门</p><b></b> </div> <a class="jbtitle-more flexRow" href="/articlelist.html" title="更多"><span>更多</span><b></b></a> </div> <div class="swiper weekswiper index"> <div class="swiper-wrapper"> </div> </div> <div class="swiper-pagination weekswiper-pagination"></div> <script> var mySwiper = new Swiper('.weekswiper', { autoplay: false, pagination: { el: '.weekswiper-pagination', clickable: true, }, spaceBetween: 20 }) </script> </div> <div class="cdr-weekchoose cdr-newwz"> <div class="jb-titles flexRow"> <div class="jbtle-left flexRow"><b></b> <p>最新文章</p><b></b> </div> <a class="jbtitle-more flexRow" href="/articlelist.html" title="更多"><span>更多</span><b></b></a> </div> <div class="weekch-list"> <div class="weekch-con flexRow"> <div class="flexRow weekcond"> <div class="weekch-icon flexRow"><b></b></div> <a href="/article/593762.html" class="weekcha flexRow flexcenter overflowclass" title="Python实现SSE实时推送方法">Python实现SSE实时推送方法</a> </div> <span class="weekcn-time">05.09</span> </div> <div class="weekch-con flexRow"> <div class="flexRow weekcond"> <div class="weekch-icon flexRow"><b></b></div> <a href="/article/593761.html" class="weekcha flexRow flexcenter overflowclass" title="ShadowDOM如何实现样式隔离与结构保护">ShadowDOM如何实现样式隔离与结构保护</a> </div> <span class="weekcn-time">05.09</span> </div> <div class="weekch-con flexRow"> <div class="flexRow weekcond"> <div class="weekch-icon flexRow"><b></b></div> <a href="/article/593760.html" class="weekcha flexRow flexcenter overflowclass" title="PHP代码加密与混淆技巧解析">PHP代码加密与混淆技巧解析</a> </div> <span class="weekcn-time">05.09</span> </div> <div class="weekch-con flexRow"> <div class="flexRow weekcond"> <div class="weekch-icon flexRow"><b></b></div> <a href="/article/593759.html" class="weekcha flexRow flexcenter overflowclass" title="豆包AI用户画像,精准定位客户群体">豆包AI用户画像,精准定位客户群体</a> </div> <span class="weekcn-time">05.09</span> </div> <div class="weekch-con flexRow"> <div class="flexRow weekcond"> <div class="weekch-icon flexRow"><b></b></div> <a href="/article/593758.html" class="weekcha flexRow flexcenter overflowclass" title="PythonNumPy特征值与向量计算方法">PythonNumPy特征值与向量计算方法</a> </div> <span class="weekcn-time">05.09</span> </div> <div class="weekch-con flexRow"> <div class="flexRow weekcond"> <div class="weekch-icon flexRow"><b></b></div> <a href="/article/593757.html" class="weekcha flexRow flexcenter overflowclass" title="番茄音乐免费听歌技巧分享">番茄音乐免费听歌技巧分享</a> </div> <span class="weekcn-time">05.09</span> </div> <div class="weekch-con flexRow"> <div class="flexRow weekcond"> <div class="weekch-icon flexRow"><b></b></div> <a href="/article/593756.html" class="weekcha flexRow flexcenter overflowclass" title="HTML如何布局大型网站内容">HTML如何布局大型网站内容</a> </div> <span class="weekcn-time">05.09</span> </div> <div class="weekch-con flexRow"> <div class="flexRow weekcond"> <div class="weekch-icon flexRow"><b></b></div> <a href="/article/593755.html" class="weekcha flexRow flexcenter overflowclass" title="phpEnv安装WikiJS教程及配置方法">phpEnv安装WikiJS教程及配置方法</a> </div> <span class="weekcn-time">05.09</span> </div> <div class="weekch-con flexRow"> <div class="flexRow weekcond"> <div class="weekch-icon flexRow"><b></b></div> <a href="/article/593754.html" class="weekcha flexRow flexcenter overflowclass" title="JS生成JSON导出为本地文件方法">JS生成JSON导出为本地文件方法</a> </div> <span class="weekcn-time">05.09</span> </div> <div class="weekch-con flexRow"> <div class="flexRow weekcond"> <div class="weekch-icon flexRow"><b></b></div> <a href="/article/593753.html" class="weekcha flexRow flexcenter overflowclass" title="JavaScript秒级倒计时代码实现">JavaScript秒级倒计时代码实现</a> </div> <span class="weekcn-time">05.09</span> </div> </div> </div> <div class="cdr-hot cdr-hotzt comlists"> <div class="jb-titles flexRow"> <div class="jbtle-left flexRow"><b></b> <p>热门专题</p><b></b> </div> <a class="jbtitle-more flexRow" href="/topic.html" title="更多"><span>更多</span><b></b></a> </div> <div class="swiper hotswiper index"> <div class="swiper-wrapper"> <div class="swiper-slide flexcolumn weekslide"> <ul class="hot-list"> <li> <div class="sidebar-card flexRow"> <a href="/topic/go-netip-ipv6-address-engineering.html" class="sidebar-card-thumb flexRow flexcenter" title="Go netip 与 IPv6 地址工程实践专题"> <!-- <div class="cdtm-tops cdtmtp-hot">热门</div> --> <img class="lazyload" src="/statics/image/moren1.png" data-src="https://img.17golang.com/uploads/topic/go-netip-ipv6-address-engineering/cover-ai-generated.png" alt="Go netip 与 IPv6 地址工程实践专题" onerror="this.src='/statics/image/moren2.png'"> </a> <div class="sidebar-card-body"> <a href="/topic/go-netip-ipv6-address-engineering.html" title="Go netip 与 IPv6 地址工程实践专题" class="sidebar-card-title overflowclass">Go netip 与 IPv6 地址工程实践专题</a> <p class=" overflowclass">从 Addr、AddrPort 到前缀判断、IPv6 端口与主机解析</p> </div> </div> </li> <li> <div class="sidebar-card flexRow"> <a href="/topic/go-container-gomaxprocs-resource-governance.html" class="sidebar-card-thumb flexRow flexcenter" title="Go 容器 CPU 与 GOMAXPROCS 资源治理专题"> <!-- <div class="cdtm-tops cdtmtp-hot">热门</div> --> <img class="lazyload" src="/statics/image/moren1.png" data-src="https://img.17golang.com/uploads/topic/go-container-gomaxprocs-resource-governance/cover-ai-generated.png" alt="Go 容器 CPU 与 GOMAXPROCS 资源治理专题" onerror="this.src='/statics/image/moren2.png'"> </a> <div class="sidebar-card-body"> <a href="/topic/go-container-gomaxprocs-resource-governance.html" title="Go 容器 CPU 与 GOMAXPROCS 资源治理专题" class="sidebar-card-title overflowclass">Go 容器 CPU 与 GOMAXPROCS 资源治理专题</a> <p class=" overflowclass">从 cgroup CPU 配额到 Go 调度器与线上资源排障</p> </div> </div> </li> <li> <div class="sidebar-card flexRow"> <a href="/topic/redis-8-ai-go-production-engineering.html" class="sidebar-card-thumb flexRow flexcenter" title="Redis 8 AI 数据结构与 Go 生产迁移专题"> <!-- <div class="cdtm-tops cdtmtp-hot">热门</div> --> <img class="lazyload" src="/statics/image/moren1.png" data-src="https://img.17golang.com/uploads/topic/redis-8-ai-go-production-engineering/cover-ai-generated.png" alt="Redis 8 AI 数据结构与 Go 生产迁移专题" onerror="this.src='/statics/image/moren2.png'"> </a> <div class="sidebar-card-body"> <a href="/topic/redis-8-ai-go-production-engineering.html" title="Redis 8 AI 数据结构与 Go 生产迁移专题" class="sidebar-card-title overflowclass">Redis 8 AI 数据结构与 Go 生产迁移专题</a> <p class=" overflowclass">从 Redis 8、Vector Set 到 Go 服务的缓存与高可用升级</p> </div> </div> </li> </ul> </div> <div class="swiper-slide flexcolumn weekslide"> <ul class="hot-list"> <li> <div class="sidebar-card flexRow"> <a href="/topic/vite-8-rolldown-frontend-engineering.html" class="sidebar-card-thumb flexRow flexcenter" title="Vite 8 与 Rolldown 前端构建工程实践专题"> <!-- <div class="cdtm-tops cdtmtp-hot">热门</div> --> <img class="lazyload" src="/statics/image/moren1.png" data-src="https://img.17golang.com/uploads/topic/vite-8-rolldown-frontend-engineering/cover-ai-generated.png" alt="Vite 8 与 Rolldown 前端构建工程实践专题" onerror="this.src='/statics/image/moren2.png'"> </a> <div class="sidebar-card-body"> <a href="/topic/vite-8-rolldown-frontend-engineering.html" title="Vite 8 与 Rolldown 前端构建工程实践专题" class="sidebar-card-title overflowclass">Vite 8 与 Rolldown 前端构建工程实践专题</a> <p class=" overflowclass">从 Rolldown 迁移、插件兼容到构建性能与生产验收</p> </div> </div> </li> <li> <div class="sidebar-card flexRow"> <a href="/topic/go-delve-debugging-practice.html" class="sidebar-card-thumb flexRow flexcenter" title="Go Delve 调试实战专题"> <!-- <div class="cdtm-tops cdtmtp-hot">热门</div> --> <img class="lazyload" src="/statics/image/moren1.png" data-src="https://img.17golang.com/uploads/topic/go-delve-debugging-practice/cover-ai-generated.png" alt="Go Delve 调试实战专题" onerror="this.src='/statics/image/moren2.png'"> </a> <div class="sidebar-card-body"> <a href="/topic/go-delve-debugging-practice.html" title="Go Delve 调试实战专题" class="sidebar-card-title overflowclass">Go Delve 调试实战专题</a> <p class=" overflowclass">从断点、DAP 到远程调试与并发故障定位</p> </div> </div> </li> <li> <div class="sidebar-card flexRow"> <a href="/topic/wails-v3-go-desktop-engineering.html" class="sidebar-card-thumb flexRow flexcenter" title="Wails v3 Go 桌面应用工程实践专题"> <!-- <div class="cdtm-tops cdtmtp-hot">热门</div> --> <img class="lazyload" src="/statics/image/moren1.png" data-src="https://img.17golang.com/uploads/topic/wails-v3-go-desktop-engineering/cover-ai-generated.png" alt="Wails v3 Go 桌面应用工程实践专题" onerror="this.src='/statics/image/moren2.png'"> </a> <div class="sidebar-card-body"> <a href="/topic/wails-v3-go-desktop-engineering.html" title="Wails v3 Go 桌面应用工程实践专题" class="sidebar-card-title overflowclass">Wails v3 Go 桌面应用工程实践专题</a> <p class=" overflowclass">从跨平台窗口、Go 绑定到 Web UI 与生产构建</p> </div> </div> </li> </ul> </div> <div class="swiper-slide flexcolumn weekslide"> <ul class="hot-list"> <li> <div class="sidebar-card flexRow"> <a href="/topic/go-race-detector-concurrency-correctness.html" class="sidebar-card-thumb flexRow flexcenter" title="Go 竞态检测与并发正确性工程专题"> <!-- <div class="cdtm-tops cdtmtp-hot">热门</div> --> <img class="lazyload" src="/statics/image/moren1.png" data-src="https://img.17golang.com/uploads/topic/go-race-detector-concurrency-correctness/cover-ai-generated.png" alt="Go 竞态检测与并发正确性工程专题" onerror="this.src='/statics/image/moren2.png'"> </a> <div class="sidebar-card-body"> <a href="/topic/go-race-detector-concurrency-correctness.html" title="Go 竞态检测与并发正确性工程专题" class="sidebar-card-title overflowclass">Go 竞态检测与并发正确性工程专题</a> <p class=" overflowclass">从数据竞争定位到同步验收</p> </div> </div> </li> <li> <div class="sidebar-card flexRow"> <a href="/topic/go-emudhra-urgent-ca-incident-response.html" class="sidebar-card-thumb flexRow flexcenter" title="Go eMudhra CA 密钥事件响应与 TLS 信任恢复专题"> <!-- <div class="cdtm-tops cdtmtp-hot">热门</div> --> <img class="lazyload" src="/statics/image/moren1.png" data-src="https://img.17golang.com/uploads/topic/go-emudhra-urgent-ca-incident-response/cover-ai-generated.png" alt="Go eMudhra CA 密钥事件响应与 TLS 信任恢复专题" onerror="this.src='/statics/image/moren2.png'"> </a> <div class="sidebar-card-body"> <a href="/topic/go-emudhra-urgent-ca-incident-response.html" title="Go eMudhra CA 密钥事件响应与 TLS 信任恢复专题" class="sidebar-card-title overflowclass">Go eMudhra CA 密钥事件响应与 TLS 信任恢复专题</a> <p class=" overflowclass">从 URGENT 安全发布到证书信任、二进制核验与回滚</p> </div> </div> </li> <li> <div class="sidebar-card flexRow"> <a href="/topic/go-binary-build-metadata-engineering.html" class="sidebar-card-thumb flexRow flexcenter" title="Go 二进制构建与元数据工程实践专题"> <!-- <div class="cdtm-tops cdtmtp-hot">热门</div> --> <img class="lazyload" src="/statics/image/moren1.png" data-src="https://img.17golang.com/uploads/topic/go-binary-build-metadata-engineering/cover-ai-generated.png" alt="Go 二进制构建与元数据工程实践专题" onerror="this.src='/statics/image/moren2.png'"> </a> <div class="sidebar-card-body"> <a href="/topic/go-binary-build-metadata-engineering.html" title="Go 二进制构建与元数据工程实践专题" class="sidebar-card-title overflowclass">Go 二进制构建与元数据工程实践专题</a> <p class=" overflowclass">从 go build 到可审计、可诊断、可交付的 Go 制品</p> </div> </div> </li> </ul> </div> </div> </div> <div class="swiper-pagination hotswiper-pagination"></div> <script> var mySwiper = new Swiper('.hotswiper ', { autoplay: false, pagination: { el: '.hotswiper-pagination', clickable: true, }, spaceBetween: 20 }) </script> </div> </div> </main> <footer> <div class="foot"> <nav class="foot-top" aria-label="页脚导航"> <a href="/about/1.html" target="_blank" title="关于我们">关于我们</a> <a href="/about/2.html" target="_blank" title="联系我们">联系我们</a> <a href="/send.html" title="内容提交">内容提交</a> <a href="/manual/go/" target="_blank" title="手册">手册</a> <a href="/about/3.html" title="用户协议">用户协议</a> <a href="/about/4.html" title="隐私条款">隐私条款</a> <a href="/about/5.html" target="_blank" title="免责声明">免责声明</a> <a href="/sitemap.xml" title="网站地图">网站地图</a> </nav> <div class="foot-down flexColumn"> <p>Copyright 2023 http://www.17golang.com/ All Rights Reserved</p> <p><a href="https://beian.miit.gov.cn/" target="_blank" title="备案">湘ICP备19018815号-4</a></p> </div> </div> </footer> <script src="/statics/m/js/common.js?1795660095"></script> <!-- Matomo --> <script> var siteId = 7; var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="https://tongji.17golang.com/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', siteId]); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Matomo Code --> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?0b3254429352a3734d2f725db8fb7a9f"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <div class="topalllist-layer" id="site-menu"> <div class="tpalist"> <div class="tpal-title flexRow "> <div class="tpaltd flexRow"> <p class="menutitle">全部分类</p> <a class="goindex flexRow" href="#site-menu" title="关闭菜单" aria-label="关闭菜单"><b></b></a> </div> </div> <div class="tpal-lists flexRow"> <a class="tpala overflowclass" href="/" title="首页">首页</a> <a class="tpala overflowclass" href="/articlelist.html" title="技术文章">技术文章</a> <a class="tpala overflowclass" href="/articlelist/44_new_0_1.html" title="Go教程">Go教程</a> <a class="tpala overflowclass" href="/articlelist/81_new_0_1.html" title="人工智能文章">人工智能文章</a> <a class="tpala overflowclass" href="/courselist.html" title="视频课程">视频课程</a> <a class="tpala overflowclass" href="/downlist.html" title="资源下载">资源下载</a> <a class="tpala overflowclass" href="/topic.html" title="技术专题">技术专题</a> <a class="tpala overflowclass" href="/ai.html" title="AI工具">AI工具</a> <a class="tpala overflowclass" href="/roadmap.html" title="Go 语言学习路线">Go 语言学习路线</a> <a class="tpala overflowclass" href="/manual/go/" title="Go 手册">Go 手册</a> <a class="tpala overflowclass" href="/runcode" title="运行代码">运行代码</a> </div> </div> </div> <div class="search-layer" > <div class="search-layerbg"> <div class="schbg flexColumn"> <div class="sechtitle flexRow"><b></b></div> <div class="sechcon"> <a href="/" title="首页" class="sechconlogoa flexRow"><img src="/statics/m/image/logo.png" alt="首页" ></a> <form class="serchd flexRow flexcenter" method="get" action="/search?q=&type=&page=1"> <input type="text" placeholder="输入关键词搜索" name="q" value="" class="text searchtext"> <input type="submit" class="serchp" value=""> </form> </div> </div> </div> </div> </body> </html>