搜索
首页web前端html教程html插入图片和html添加图片的示例

在html插入图片 让图片显示需要HTML标签来实现,使用img标签即可实现。

一、html图片标签语法

代码如下:

<img src="pcss5-logo-201305.gif" width="165" height="60" />

img介绍:

src 后跟的是图片路径地址

width 设置图片宽度

height 设置图片高度

二、具体html 图片显示实例   -   TOP

我们在html源代码中分别插入三张图片,一张原始大、一张将宽度高度改小小、一张将宽度高度改大。

1、实例完整html代码:

代码如下:

 
 
 
 
图片插入html 在线演示 <a href="http://www.vcss.com</title">www.vcss.com</title</a>> 
</head> 

<body> 
<p>原始大图片</p> 
<p> 
<img src="pcss5-logo-201305.gif" width="165" height="60" /> 
</p> 
<p>改小图片</p> 
<p> 
<img src="pcss5-logo-201305.gif" width="105" height="30" /> 
</p> 
<p>改大图片</p> 
<p> 
<img src="pcss5-logo-201305.gif" width="365" height="120" /> 
</p> 
</body> 
</html></pre><p>2、html插入图片实例截图</p>
<p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/013/01a9772901e3e927a85b643220ded383-0.png" class="lazy" alt="html插入图片和html添加图片的示例"    style="max-width:90%"  style="max-width:90%" title="html插入图片和html添加图片的示例"></p>
<p>html图片插入显示实例截图</p>
<p>更多html插入图片和html添加图片的示例相关文章请关注PHP中文网!</p></div><div class="wzconShengming_sp"><div class="bzsmdiv_sp">声明</div><div>本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn</div></div></div><div class="phpgenera_Details_mainL4"><div class="phpmain1_2_top"><a href="javascript:void(0);" class="phpmain1_2_top_title">相关文章<img class="lazy"
                            data-src="/static/imghwm/index2_title2.png" src="/static/imghw/default1.png" alt="" /></a></div><div class="phpgenera_Details_mainL4_info"><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh/faq/1796795191.html" title="从文本到网站:HTML的力量" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="https://img.php.cn/upload/article/001/253/068/174447404295304.jpg?x-oss-process=image/resize,p_40" alt="从文本到网站:HTML的力量" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/zh/faq/1796795191.html" title="从文本到网站:HTML的力量" class="phphistorical_Version2_mids_title">从文本到网站:HTML的力量</a><span class="Articlelist_txts_time">Apr 13, 2025 am	 12:07 AM</span><p class="Articlelist_txts_p">HTML是一种用于构建网页的语言,通过标签和属性定义网页结构和内容。1)HTML通过标签组织文档结构,如、。2)浏览器解析HTML构建DOM并渲染网页。3)HTML5的新特性如、、增强了多媒体功能。4)常见错误包括标签未闭合和属性值未加引号。5)优化建议包括使用语义化标签和减少文件大小。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh/faq/1796794693.html" title="了解HTML,CSS和JavaScript:初学者指南" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="https://img.php.cn/upload/article/001/253/068/174438733162787.jpg?x-oss-process=image/resize,p_40" alt="了解HTML,CSS和JavaScript:初学者指南" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/zh/faq/1796794693.html" title="了解HTML,CSS和JavaScript:初学者指南" class="phphistorical_Version2_mids_title">了解HTML,CSS和JavaScript:初学者指南</a><span class="Articlelist_txts_time">Apr 12, 2025 am	 12:02 AM</span><p class="Articlelist_txts_p">WebDevelovermentReliesonHtml,CSS和JavaScript:1)HTMLStructuresContent,2)CSSStyleSIT和3)JavaScriptAddSstractivity,形成thebasisofmodernWebemodernWebExexperiences。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh/faq/1796794180.html" title="HTML的角色:构建Web内容" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="https://img.php.cn/upload/article/001/253/068/174430155217186.jpg?x-oss-process=image/resize,p_40" alt="HTML的角色:构建Web内容" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/zh/faq/1796794180.html" title="HTML的角色:构建Web内容" class="phphistorical_Version2_mids_title">HTML的角色:构建Web内容</a><span class="Articlelist_txts_time">Apr 11, 2025 am	 12:12 AM</span><p class="Articlelist_txts_p">HTML的作用是通过标签和属性定义网页的结构和内容。1.HTML通过到、等标签组织内容,使其易于阅读和理解。2.使用语义化标签如、等增强可访问性和SEO。3.优化HTML代码可以提高网页加载速度和用户体验。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh/faq/1796793634.html" title="HTML和代码:仔细观察术语" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="https://img.php.cn/upload/article/001/253/068/174424853215422.jpg?x-oss-process=image/resize,p_40" alt="HTML和代码:仔细观察术语" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/zh/faq/1796793634.html" title="HTML和代码:仔细观察术语" class="phphistorical_Version2_mids_title">HTML和代码:仔细观察术语</a><span class="Articlelist_txts_time">Apr 10, 2025 am	 09:28 AM</span><p class="Articlelist_txts_p">htmlisaspecifictypefodyfocusedonstructuringwebcontent,而“代码” badlyLyCludEslanguagesLikeLikejavascriptandPytyPythonForFunctionality.1)htmldefineswebpagertuctureduseTags.2)“代码”代码“ code” code code code codeSpassSesseseseseseseseAwiderRangeLangeLangeforLageforLogageforLogicIctInterract</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh/faq/1796793129.html" title="HTML,CSS和JavaScript:Web开发人员的基本工具" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="https://img.php.cn/upload/article/001/253/068/174412873346901.jpg?x-oss-process=image/resize,p_40" alt="HTML,CSS和JavaScript:Web开发人员的基本工具" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/zh/faq/1796793129.html" title="HTML,CSS和JavaScript:Web开发人员的基本工具" class="phphistorical_Version2_mids_title">HTML,CSS和JavaScript:Web开发人员的基本工具</a><span class="Articlelist_txts_time">Apr 09, 2025 am	 12:12 AM</span><p class="Articlelist_txts_p">HTML、CSS和JavaScript是Web开发的三大支柱。1.HTML定义网页结构,使用标签如、等。2.CSS控制网页样式,使用选择器和属性如color、font-size等。3.JavaScript实现动态效果和交互,通过事件监听和DOM操作。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh/faq/1796792987.html" title="HTML,CSS和JavaScript的角色:核心职责" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="https://img.php.cn/upload/article/001/253/068/174411031220217.jpg?x-oss-process=image/resize,p_40" alt="HTML,CSS和JavaScript的角色:核心职责" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/zh/faq/1796792987.html" title="HTML,CSS和JavaScript的角色:核心职责" class="phphistorical_Version2_mids_title">HTML,CSS和JavaScript的角色:核心职责</a><span class="Articlelist_txts_time">Apr 08, 2025 pm	 07:05 PM</span><p class="Articlelist_txts_p">HTML定义网页结构,CSS负责样式和布局,JavaScript赋予动态交互。三者在网页开发中各司其职,共同构建丰富多彩的网站。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh/faq/1796791823.html" title="HTML容易为初学者学习吗?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="https://img.php.cn/upload/article/001/253/068/174395586298618.jpg?x-oss-process=image/resize,p_40" alt="HTML容易为初学者学习吗?" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/zh/faq/1796791823.html" title="HTML容易为初学者学习吗?" class="phphistorical_Version2_mids_title">HTML容易为初学者学习吗?</a><span class="Articlelist_txts_time">Apr 07, 2025 am	 12:11 AM</span><p class="Articlelist_txts_p">HTML适合初学者学习,因为它简单易学且能快速看到成果。1)HTML的学习曲线平缓,易于上手。2)只需掌握基本标签即可开始创建网页。3)灵活性高,可与CSS和JavaScript结合使用。4)丰富的学习资源和现代工具支持学习过程。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh/faq/1796791144.html" title="HTML中起始标签的示例是什么?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="https://img.php.cn/upload/article/001/253/068/174386905283883.jpg?x-oss-process=image/resize,p_40" alt="HTML中起始标签的示例是什么?" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/zh/faq/1796791144.html" title="HTML中起始标签的示例是什么?" class="phphistorical_Version2_mids_title">HTML中起始标签的示例是什么?</a><span class="Articlelist_txts_time">Apr 06, 2025 am	 12:04 AM</span><p class="Articlelist_txts_p">AnexampleOfAstartingTaginHtmlis,beginSaparagraph.startingTagSareEssentialInhtmlastheyInitiateEllements,defiteTheeTheErtypes,andarecrucialforsstructuringwebpages wepages webpages andConstructingthedom。</p></div></div><a href="https://m.php.cn/zh/web-designer.html" class="phpgenera_Details_mainL4_botton"><span>See all articles</span><img class="lazy" data-src="/static/imghwm/down_right.png" src="/static/imghw/default1.png" alt="" /></a></div><ins class="adsbygoogle"
     style="display:block"
     data-ad-format="fluid"
     data-ad-layout-key="-6t+ed+2i-1n-4w"
     data-ad-client="ca-pub-5902227090019525"
     data-ad-slot="8966999616"></ins><script>     (adsbygoogle = window.adsbygoogle || []).push({});
</script><div class="AI_ToolDetails_main4sR"><div class="phpgenera_Details_mainR3"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                            onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="/static/imghwm/hottools2.png" src="/static/imghw/default1.png" alt="" /><h2>热AI工具</h2></div><div class="phpgenera_Details_mainR3_bottom"><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                                    onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                                    data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411540686492.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undresser.AI Undress" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh/ai/undresserai-undress" title="Undresser.AI Undress"class="phpmain_tab2_mids_title"><h3>Undresser.AI Undress</h3></a><p>人工智能驱动的应用程序,用于创建逼真的裸体照片</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                                    onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                                    data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411552797167.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="AI Clothes Remover" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh/ai/ai-clothes-remover" title="AI Clothes Remover"class="phpmain_tab2_mids_title"><h3>AI Clothes Remover</h3></a><p>用于从照片中去除衣服的在线人工智能工具。</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                                    onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                                    data-src="https://img.php.cn/upload/ai_manual/001/246/273/173410641626608.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undress AI Tool" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh/ai/undress-ai-tool" title="Undress AI Tool"class="phpmain_tab2_mids_title"><h3>Undress AI Tool</h3></a><p>免费脱衣服图片</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                                    onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                                    data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411529149311.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Clothoff.io" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh/ai/clothoffio" title="Clothoff.io"class="phpmain_tab2_mids_title"><h3>Clothoff.io</h3></a><p>AI脱衣机</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh/ai/ai-hentai-generator" title="AI Hentai Generator" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                                    onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                                    data-src="https://img.php.cn/upload/ai_manual/001/246/273/173405034393877.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="AI Hentai Generator" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh/ai/ai-hentai-generator" title="AI Hentai Generator"class="phpmain_tab2_mids_title"><h3>AI Hentai Generator</h3></a><p>免费生成ai无尽的。</p></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh/ai">显示更多</a></div></div></div><div class="phpgenera_Details_mainR4"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                            onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="/static/imghwm/hotarticle2.png" src="/static/imghw/default1.png" alt="" /><h2>热门文章</h2></div><div class="phpgenera_Details_mainR4_bottom"><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh/faq/1796780570.html" title="R.E.P.O.能量晶体解释及其做什么(黄色晶体)" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.能量晶体解释及其做什么(黄色晶体)</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>3 周前</span><span>By尊渡假赌尊渡假赌尊渡假赌</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh/faq/1796780641.html" title="R.E.P.O.最佳图形设置" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.最佳图形设置</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>3 周前</span><span>By尊渡假赌尊渡假赌尊渡假赌</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh/faq/1796785841.html" title="刺客信条阴影:贝壳谜语解决方案" class="phpgenera_Details_mainR4_bottom_title">刺客信条阴影:贝壳谜语解决方案</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>2 周前</span><span>ByDDD</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh/faq/1796780520.html" title="R.E.P.O.如果您听不到任何人,如何修复音频" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.如果您听不到任何人,如何修复音频</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>3 周前</span><span>By尊渡假赌尊渡假赌尊渡假赌</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh/faq/1796779766.html" title="WWE 2K25:如何解锁Myrise中的所有内容" class="phpgenera_Details_mainR4_bottom_title">WWE 2K25:如何解锁Myrise中的所有内容</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>4 周前</span><span>By尊渡假赌尊渡假赌尊渡假赌</span></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh/article.html">显示更多</a></div></div></div><div class="phpgenera_Details_mainR3"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                            onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="/static/imghwm/hottools2.png" src="/static/imghw/default1.png" alt="" /><h2>热工具</h2></div><div class="phpgenera_Details_mainR3_bottom"><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh/toolset/development-tools/1544" title="MinGW - 适用于 Windows 的极简 GNU" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                                        onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                                        data-src="" src="/static/imghw/default1.png" alt="MinGW - 适用于 Windows 的极简 GNU" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh/toolset/development-tools/1544" title="MinGW - 适用于 Windows 的极简 GNU" class="phpmain_tab2_mids_title"><h3>MinGW - 适用于 Windows 的极简 GNU</h3></a><p>这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh/toolset/development-tools/1556" title="螳螂BT" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                                        onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                                        data-src="https://img.php.cn/upload/manual/000/000/004/169206588591843.png" src="/static/imghw/default1.png" alt="螳螂BT" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh/toolset/development-tools/1556" title="螳螂BT" class="phpmain_tab2_mids_title"><h3>螳螂BT</h3></a><p>Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh/toolset/development-tools/500" title="SublimeText3 Mac版" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                                        onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                                        data-src="https://img.php.cn/upload/manual/000/000/001/58d34035e2757995.png" src="/static/imghw/default1.png" alt="SublimeText3 Mac版" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh/toolset/development-tools/500" title="SublimeText3 Mac版" class="phpmain_tab2_mids_title"><h3>SublimeText3 Mac版</h3></a><p>神级代码编辑软件(SublimeText3)</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh/toolset/development-tools/92" title="记事本++7.3.1" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                                        onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                                        data-src="https://img.php.cn/upload/manual/000/000/001/58ab96f0f39f7357.jpg" src="/static/imghw/default1.png" alt="记事本++7.3.1" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh/toolset/development-tools/92" title="记事本++7.3.1" class="phpmain_tab2_mids_title"><h3>记事本++7.3.1</h3></a><p>好用且免费的代码编辑器</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh/toolset/development-tools/93" title="SublimeText3汉化版" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                                        onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                                        data-src="https://img.php.cn/upload/manual/000/000/001/58ab97a3baad9677.jpg" src="/static/imghw/default1.png" alt="SublimeText3汉化版" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh/toolset/development-tools/93" title="SublimeText3汉化版" class="phpmain_tab2_mids_title"><h3>SublimeText3汉化版</h3></a><p>中文版,非常好用</p></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh/ai">显示更多</a></div></div></div><div class="phpgenera_Details_mainR4"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'"
                            onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy"
                            data-src="/static/imghwm/hotarticle2.png" src="/static/imghw/default1.png" alt="" /><h2>热门话题</h2></div><div class="phpgenera_Details_mainR4_bottom"><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh/faq/gmailyxdlrkzn" title="gmail邮箱登陆入口在哪里"  class="phpgenera_Details_mainR4_bottom_title">gmail邮箱登陆入口在哪里</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png"
                                        alt="" /><span>7486</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png"
                                        alt="" /><span>15</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh/faq/cakephp-tutor" title="CakePHP 教程"  class="phpgenera_Details_mainR4_bottom_title">CakePHP 教程</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png"
                                        alt="" /><span>1377</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png"
                                        alt="" /><span>52</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/faq/steamdzhmcssmgs" title="steam的账户名称是什么格式"  class="phpgenera_Details_mainR4_bottom_title">steam的账户名称是什么格式</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png"
                                        alt="" /><span>77</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png"
                                        alt="" /><span>11</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh/faq/winactivationkeyper" title="win11激活密钥永久"  class="phpgenera_Details_mainR4_bottom_title">win11激活密钥永久</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png"
                                        alt="" /><span>51</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png"
                                        alt="" /><span>19</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh/faq/newyorktimesdailybrief" title="NYT连接提示和答案"  class="phpgenera_Details_mainR4_bottom_title">NYT连接提示和答案</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png"
                                        alt="" /><span>19</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png"
                                        alt="" /><span>38</span></div></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh/faq/zt">显示更多</a></div></div></div></div></main><ins class="adsbygoogle"
     style="display:block"
     data-ad-format="autorelaxed"
     data-ad-client="ca-pub-5902227090019525"
     data-ad-slot="5027754603"></ins><script>     (adsbygoogle = window.adsbygoogle || []).push({});
</script><footer><div class="footer"><div class="footertop"><img src="/static/imghwm/logo.png" alt=""><p>公益在线PHP培训,帮助PHP学习者快速成长!</p></div><div class="footermid"><a href="https://m.php.cn/zh/about/us.html">关于我们</a><a href="https://m.php.cn/zh/about/disclaimer.html">免责声明</a><a href="https://m.php.cn/zh/update/article_0_1.html">Sitemap</a></div><div class="footerbottom"><p>                © php.cn All rights reserved
            </p></div></div></footer><script>isLogin = 0;</script><script type="text/javascript" src="/static/layui/layui.js"></script><script type="text/javascript" src="/static/js/global.js?4.9.47"></script><script src="https://vdse.bdstatic.com//search-video.v1.min.js"></script><link rel='stylesheet' id='_main-css' href='/static/css/viewer.min.css' type='text/css' media='all'/><script type='text/javascript' src='/static/js/viewer.min.js?1'></script><script type='text/javascript' src='/static/js/jquery-viewer.min.js'></script><script>  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.php.cn/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '9']);
    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><script>        jQuery.fn.wait = function (func, times, interval) {
            var _times = times || -1, //100次
            _interval = interval || 20, //20毫秒每次
            _self = this,
            _selector = this.selector, //选择器
            _iIntervalID; //定时器id
            if( this.length ){ //如果已经获取到了,就直接执行函数
                func && func.call(this);
            } else {
                _iIntervalID = setInterval(function() {
                    if(!_times) { //是0就退出
                        clearInterval(_iIntervalID);
                    }
                    _times <= 0 || _times--; //如果是正数就 --

                    _self = $(_selector); //再次选择
                    if( _self.length ) { //判断是否取到
                        func && func.call(_self);
                        clearInterval(_iIntervalID);
                    }
                }, _interval);
            }
            return this;
}

    $("table.syntaxhighlighter").wait(function() {
        $('table.syntaxhighlighter').append("<p class='cnblogs_code_footer'><span class='cnblogs_code_footer_icon'></span></p>");
    });
    $(document).on("click", ".cnblogs_code_footer",function(){
        $(this).parents('table.syntaxhighlighter').css('display','inline-table');$(this).hide();
    });
    $('.nphpQianCont').viewer({navbar:true,title:false,toolbar:false,movable:false,viewed:function(){$('img').click(function(){$('.viewer-close').trigger('click');});}});
    </script><script>// 通用函数,用于显示或隐藏元素
function toggleElementsDisplay(className, show) {
  const elements = document.getElementsByClassName(className);
  for (let i = 0; i < elements.length; i++) {
    elements[i].style.display = show ? "block" : "none";
  }
}
// 页面加载完成后执行的主函数
document.addEventListener("DOMContentLoaded", () => {
  // 1. 绑定菜单按钮事件
  const bindMenuEvents = () => {
    const toggleDisplay = (className, show, eventId) => {
      const element = document.getElementById(eventId);
      if (element) {
        element.addEventListener("click", (event) => {
          event.preventDefault();
          toggleElementsDisplay(className, show);
        });
      }
    };
    toggleDisplay("m_editormain12main", true, "fixed_tab_img");
    toggleDisplay("m_editormain12main", false, "fixed_tab_topi");
    toggleDisplay("m_editormain12main", false, "fixed_tab_close");
    toggleDisplay("m_menu", true, "lan1sp");
    toggleDisplay("m_menu", false, "m_editormain12main_topi_sp");
    toggleDisplay("m_menu_lang", true, "lan1");
    toggleDisplay("m_menu_lang", false, "m_editormain12main_topi_lan");
  };
 // 2. 绑定滚动链接事件
const bindScrollLinks = () => {
  const titleList = document.getElementById("fixed_tab_titlelist");
  const menuMain = document.getElementsByClassName("m_editormain12main")[0];
  const links = document.querySelectorAll('.fixed_tab_a'); 
  links.forEach(linkElement => {
    if (linkElement) {
      linkElement.addEventListener("click", async (e) => {
        e.preventDefault();
        e.stopPropagation();
        // 先隐藏菜单
        if (menuMain) menuMain.style.display = "none";
        if (titleList) titleList.style.display = "none";
        // 获取目标元素的 ID
        const targetId = linkElement.getAttribute('href').substring(1);
        const targetElement = document.getElementById(targetId);
        // 等待 DOM 更新
        await new Promise(resolve => requestAnimationFrame(resolve));
        // 滚动到目标位置
        if (targetElement) {
          targetElement.scrollIntoView({
            behavior: "smooth",
            block: "start"
          });
        }
      });
    }
  });
};
  // 3. 绑定关闭按钮事件
  const bindCloseButton = () => {
    const closeButton = document.querySelector(".phpgenera_Details_mainR1_close");
    const container = document.querySelector(".phpgenera_Details_mainR1");
    if (closeButton && container) {
      closeButton.addEventListener("click", (event) => {
        event.preventDefault();
        container.style.display = "none";
      });
    }
  };
  // 4. 初始化菜单交互功能
  const initMenuInteraction = () => {
    const menuGroupElements = document.querySelectorAll('.layui-menu-item-group');
    menuGroupElements.forEach(menuItem => {
      menuItem.addEventListener('click', function(event) {
        if (event.target.closest('.m_menusnames')) {
          return;
        }
        this.classList.toggle('layui-menu-item-down');
        this.classList.toggle('layui-menu-item-up');
        const subMenuContainer = this.querySelector('.m_menusnames');
        const icon = this.querySelector('.layui-icon');
        if (subMenuContainer && icon) {
          if (this.classList.contains('layui-menu-item-down')) {
            subMenuContainer.style.display = 'block';
            icon.classList.remove('layui-icon-down');
            icon.classList.add('layui-icon-up');
          } else {
            subMenuContainer.style.display = 'none';
            icon.classList.remove('layui-icon-up');
            icon.classList.add('layui-icon-down');
          }
        }
      });
    });
  };
  // 5. 初始化 layui 功能
  const initLayui = () => {
    if (typeof layui !== 'undefined') {
      layui.use(function () {
        var util = layui.util;
        if (util && util.fixbar) {
          util.fixbar({
            on: {
              mouseenter: function (type) {
                if (layer && layer.tips) {
                  layer.tips(type, this, {
                    tips: 4,
                    fixed: true,
                  });
                }
              },
              mouseleave: function (type) {
                if (layer && layer.closeAll) {
                  layer.closeAll("tips");
                }
              },
            },
          });
        }
      });
    }
  };
  // 执行所有初始化函数
  bindMenuEvents();
  bindScrollLinks();
  bindCloseButton();
  initMenuInteraction();
  initLayui();
});
    </script></body></html>