1、概述
1.1 什么是捕获组
捕获组就是把正则表达式中子表达式匹配的内容,保存到内存中以数字编号或显式命名的组里,方便后面引用。当然,这种引用既可以是在正则表达式内部,也可以是在正则表达式外部。
捕获组有两种形式,一种是普通捕获组,另一种是命名捕获组,通常所说的捕获组指的是普通捕获组。语法如下:
普通捕获组:(Expression)
命名捕获组:(?Expression)
普通捕获组在大多数支持正则表达式的语言或工具中都是支持的,而命名捕获组目前只有.NET、PHP、Python等部分语言支持,据说Java会在7.0中提供对这一特性的支持。上面给出的命名捕获组的语法是.NET中的语法,另外在.NET中使用(?’name’Expression)与使用(?Expression)是等价的。在PHP和Python中命名捕获组语法为:(?PExpression)。
另外需要说明的一点是,除(Expression)和(?Expression)语法外,其它的(?…)语法都不是捕获组。
1.2 捕获组编号规则
编号规则指的是以数字为捕获组进行编号的规则,在普通捕获组或命名捕获组单独出现的正则表达式中,编号规则比较清晰,在普通捕获组与命名捕获组混合出现的正则表达式中,捕获组的编号规则稍显复杂。
在展开讨论之前,需要说明的是,编号为0的捕获组,指的是正则表达式整体,这一规则在支持捕获组的语言中,基本上都是适用的。下面对其它编号规则逐一展开讨论。
1.2.1 普通捕获组编号规则
如果没有显式为捕获组命名,即没有使用命名捕获组,那么需要按数字顺序来访问所有捕获组。在只有普通捕获组的情况下,捕获组的编号是按照“(”出现的顺序,从左到右,从1开始进行编号的 。
正则表达式:(d{4})-(d{2}-(dd))
上面的正则表达式可以用来匹配格式为yyyy-MM-dd的日期,为了在下表中得以区分,月和日分别采用了d{2}和dd这两种写法。
用以上正则表达式匹配字符串:2008-12-31,匹配结果为:
编号 |
命名 |
捕获组 |
匹配内容 |
0 |
(d{4})-(d{2}-(dd)) |
2008-12-31 |
|
1 |
(d{4}) |
2008 |
|
2 |
(d{2}-(dd)) |
12-31 |
|
3 |
(dd) |
31 |
1.2.2 命名捕获组编号规则
命名捕获组通过显式命名,可以通过组名方便的访问到指定的组,而不需要去一个个的数编号,同时避免了在正则表达式扩展过程中,捕获组的增加或减少对引用结果导致的不可控。
不过容易忽略的是,命名捕获组也参与了编号的,在只有命名捕获组的情况下,捕获组的编号也是按照“(”出现的顺序,从左到右,从1开始进行编号的 。
正则表达式:(?d{4})-(?d{2}-(?dd))
用以上正则表达式匹配字符串:2008-12-31
匹配结果为:
编号 |
命名 |
捕获组 |
匹配内容 |
0 |
(?d{4})-(?d{2}-(?dd)) |
2008-12-31 |
|
1 |
year |
(?d{4}) |
2008 |
2 |
date |
(?d{2}-(?dd)) |
12-31 |
3 |
day |
(?dd) |
31 |
1.2.3 普通捕获组与命名捕获组混合编号规则
当一个正则表达式中,普通捕获组与命名捕获组混合出现时,捕获组的编号规则稍显复杂。对于其中的命名捕获组,随时都可以通过组名进行访问,而对于普通捕获组,则只能通过确定其编号后进行访问。
混合方式的捕获组编号,首先按照普通捕获组中“(”出现的先后顺序,从左到右,从1开始进行编号,当普通捕获组编号完成后,再按命名捕获组中“(”出现的先后顺序,从左到右,接着普通捕获组的编号值继续进行编号。
也就是先忽略命名捕获组,对普通捕获组进行编号,当普通捕获组完成编号后,再对命名捕获组进行编号。
正则表达式:(d{4})-(?d{2}-(dd))
用以上正则表达式匹配字符串:2008-12-31,匹配结果为:
编号 |
命名 |
捕获组 |
匹配内容 |
0 |
(d{4})-(?d{2}-(dd)) |
2008-12-31 |
|
1 |
(d{4}) |
2008 |
|
3 |
date |
(?d{2}-(dd)) |
12-31 |
2 |
(dd) |
31 |
2、捕获组的引用
对捕获组的引用一般有以下几种:
1)正则表达式中,对前面捕获组捕获的内容进行引用,称为反向引用;
2)正则表达式中,(?(name)yes|no)的条件判断结构;
3)在程序中,对捕获组捕获内容的引用。
2.1 反向引用
捕获组捕获到的内容,不仅可以在正则表达式外部通过程序进行引用,也可以在正则表达式内部进行引用,这种引用方式就是反向引用。
反向引用的作用通常是用来查找或限定重复,限定指定标识配对出现等等。
对于普通捕获组和命名捕获组的引用,语法如下:
普通捕获组反向引用:k,通常简写为number
命名捕获组反向引用:k或者k’name’
普通捕获组反向引用中number是十进制的数字,即捕获组的编号;命名捕获组反向引用中的name为命名捕获组的组名。
反向引用涉及到的内容比较多,后续单独说明。
2.2 条件判断表达式
条件判断结构在平衡组中谈到过,基本应用和扩展应用都可以在其中找到例子,这里不再赘述,请参考 .NET正则基础之——平衡组。
2.3 程序中引用
根据语言的不同,程序中对捕获组引用的方式也有所不同,下面就JavaScript和.NET进行举例说明。
2.3.1 JavaScript中的引用
由于JavaScript中不支持命名捕获组,所以对于捕获组的引用就只支持普通捕获组的反向引用和$number方式的引用。程序中的引用一般在替换和匹配时使用。
注:以下应用举例仅考虑简单应用场景,对于这种复杂场景暂不考虑。
1) 在Replace中引用,通常是通过$number方式引用。
举例:替换掉html标签中的属性。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | <textarea id= "result" rows= "10" cols= "100" ></textarea> var data = "<table id=" test "><tbody><tr class=" light "><td> test " ; var reg = /]*>/ig; document.getElementById( "result" ).value = data.replace(reg, "" ); //输出 <table> <tbody><tr> <td> test </td> </tr> </tbody></table> <p>2) 在匹配时的引用,通常通过RegExp.$number方式引用。</p> <p>举例:同时获取<img>中的src和name属性值,属性的顺序不固定。参考 一条正则能不能同时取出一个img标记的src和name?</p> <div class = "jb51code" > <pre class = "brush:js;" ><textarea id= "result" rows= "10" cols= "100" ></textarea> var data = [ ' <img decoding="async" alt="" border="0" src="/bmp/foo1.jpg">' , ' <img decoding="async" src="/bmp/foo2.jpg" alt="" border="0">' ] ; var reg = /]+)1)(?:(?!src=).)*src=([ '"]?)([^' "s>]+)3[^>]*>/i; for ( var i=0;i<data.length;i++) { var s = data[i]; document.getElementById( "result" ).value += "源字符串:" + s + "n" ; document.write( "<br>" ); if (reg.test(s)) { document.getElementById( "result" ).value += "name: " + RegExp.$2 + "n" ; document.getElementById( "result" ).value += "src: " + RegExp.$4 + "n" ; } } </pre> </div> <p class = "maodian" ><a name= "_label3_1_4_4" ></a></p> <h4>2.3.2 .NET中的引用</h4> <p>由于.NET支持命名捕获组,所以在.NET中的引用方式会多一些。通常也是在两种场景下应用,一是替换,一是匹配。</p> <p>1) 替换中的引用</p> <p>普通捕获组:$number</p> <p>命名捕获组:${name}</p> <p>替换中应用,仍是上面的例子。</p> <p>举例:替换掉html标签中的属性。使用普通捕获组。</p> <div class = "jb51code" > <pre class = "brush:vb;" >string data = "</pre> <table id=" "test" "> <tbody><tr class=" "light" "> <td> test </td> </tr> </tbody></table> <p>“;<br> richTextBox2.Text = Regex.Replace(data, @”(?i)]*>”, “”);<br> //输出</p> <table> <tbody><tr> <td> test </td> </tr> </tbody></table> </div> <p>使用命名捕获组。</p> <div class=" jb51code "> <pre class=" brush:vb; ">string data = " </pre> <table id= ""test"" > <tbody><tr class = ""light"" > <td> test </td> </tr> </tbody></table> <p>“;<br> richTextBox2.Text = Regex.Replace(data, @”(?i)[a-z]+)[^>]*>”, “”);<br> //输出</p> <table> <tbody><tr> <td> test </td> </tr> </tbody></table> </div> <p>2) 匹配后的引用</p> <p>对于匹配结果中捕获组捕获内容的引用,可以通过Groups和Result对象进行引用。</p> <div class = "jb51code" > <pre class = "brush:vb;" >string test = "<a href=" %5C%22 //www.2it.club%5C%22">jb51</a>"; Regex reg = new Regex(@ "(?is)<a>[^" "'s>]*)1[^>]*>(?(?:(?!</a>).)*)" ); MatchCollection mc = reg.Matches(test); foreach (Match m in mc) { richTextBox2.Text += "m.Value:" .PadRight(25) + m.Value + "n" ; richTextBox2.Text += "m.Result(" $0 "):" .PadRight(25) + m.Result( "$0" ) + "n" ; richTextBox2.Text += "m.Groups[0].Value:" .PadRight(25) + m.Groups[0].Value + "n" ; richTextBox2.Text += "m.Result(" $2 "):" .PadRight(25) + m.Result( "$2" ) + "n" ; richTextBox2.Text += "m.Groups[2].Value:" .PadRight(25) + m.Groups[2].Value + "n" ; richTextBox2.Text += "m.Result(" ${url} "):" .PadRight(25) + m.Result( "${url}" ) + "n" ; richTextBox2.Text += "m.Groups[" url "].Value:" .PadRight(25) + m.Groups[ "url" ].Value + "n" ; richTextBox2.Text += "m.Result(" $3 "):" .PadRight(25) + m.Result( "$3" ) + "n" ; richTextBox2.Text += "m.Groups[3].Value:" .PadRight(25) + m.Groups[3].Value + "n" ; richTextBox2.Text += "m.Result(" ${text} "):" .PadRight(25) + m.Result( "${text}" ) + "n" ; richTextBox2.Text += "m.Groups[" text "].Value:" .PadRight(25) + m.Groups[ "text" ].Value + "n" ; } //输出 m.Value: <a href= "//www.2it.club" >jb51</a> m.Result( "$0" ): <a href= "//www.2it.club" >jb51</a> m.Groups[0].Value: <a href= "//www.2it.club" >jb51</a> m.Result( "$2" ): //www.2it.club m.Groups[2].Value: //www.2it.club m.Result( "${url}" ): //www.2it.club m.Groups[ "url" ].Value: //www.2it.club m.Result( "$3" ): jb51 m.Groups[3].Value: jb51 m.Result( "${text}" ): jb51 m.Groups[ "text" ].Value: jb51</pre> </div> <p>对于捕获组0的引用,可以简写作m.Value。</p> <p>到此这篇关于正则基础之 捕获组(capture group)的文章就介绍到这了,更多相关正则捕获组内容请搜索IT俱乐部以前的文章或继续浏览下面的相关文章希望大家以后多多支持IT俱乐部!</p> <!-- .entry-content --> <div id= "happythemes-ad-5" class = "single-bottom-ad widget_ad ad-widget" ></div> <div class = "single-credit" > 本文收集自网络,不代表IT俱乐部立场,转载请注明出处。<a href= "https://www.2it.club/navsub/regex/8231.html" "=" ">https://www.2it.club/navsub/regex/8231.html</a> </div> <div class=" entry-footer clear "> <div class=" entry-footer-right "> <span class=" entry-like "> <span class=" sl-wrapper "><a href=" https: //www.2it.club/wp-admin/admin-ajax.php?action=process_simple_like&post_id=8231&nonce=126e80d8dc&is_comment=0&disabled=true" class="sl-button sl-button-8231" data-nonce="126e80d8dc" data-post-id="8231" data-iscomment="0" title="点赞这篇文章"><span class="sl-count"><i class="fa fa-thumbs-o-up"></i> 122<em>赞</em></span></a><span class="sl-loader"></span></span> </span><!-- .entry-like --> </div> </div><!-- .entry-footer --> <div class ="entry-bottom clear "> <div class=" entry-tags "> <span class=" tag-links "><span>标签:</span><a href=" https: //www.2it.club/tag/capture" rel="tag">capture</a> <a href="https://www.2it.club/tag/group" rel="tag">group</a> <a href="https://www.2it.club/tag/%e5%9f%ba%e7%a1%80" rel="tag">基础</a> <a href="https://www.2it.club/tag/%e6%8d%95%e8%8e%b7" rel="tag">捕获</a> <a href="https://www.2it.club/tag/%e6%ad%a3%e5%88%99" rel="tag">正则</a></span> </div><!-- .entry-tags --> <span class ="custom-share "> <span class=" social-share share-component " data-sites=" wechat, weibo, qq, qzone "><a class=" social-share-icon icon-wechat " href=" javascript: "><div class=" wechat-qrcode "><h4>微信扫一扫:分享</h4><div class=" qrcode " title=" https: //www.2it.club/navsub/regex/8231.html"><canvas width="100" height="100" style="display: none;"></canvas><img alt="Scan me!" src="data:image/png;base64,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" style="display: block;"></div><div class="help"><p>微信里点“发现”,扫一下</p></div></div></a><a class="social-share-icon icon-weibo" href="https://service.weibo.com/share/share.php?url=https%3A%2F%2Fwww.2it.club%2Fnavsub%2Fregex%2F8231.html&title=%E6%AD%A3%E5%88%99%E5%9F%BA%E7%A1%80%E4%B9%8B%C2%A0%E6%8D%95%E8%8E%B7%E7%BB%84(capture%C2%A0group)-IT%E4%BF%B1%E4%B9%90%E9%83%A8&pic=https%3A%2F%2Fwww.2it.club%2Fwp-content%2Fuploads%2F2023%2F07%2Ffrc-8dd91a40df5faa357d5ddf0ca0d63bed.jpg&appkey=" target="_blank"></a><a class="social-share-icon icon-qq" href="http://connect.qq.com/widget/shareqq/index.html?url=https%3A%2F%2Fwww.2it.club%2Fnavsub%2Fregex%2F8231.html&title=%E6%AD%A3%E5%88%99%E5%9F%BA%E7%A1%80%E4%B9%8B%C2%A0%E6%8D%95%E8%8E%B7%E7%BB%84(capture%C2%A0group)-IT%E4%BF%B1%E4%B9%90%E9%83%A8&source=%E6%AD%A3%E5%88%99%E5%9F%BA%E7%A1%80%E4%B9%8B%C2%A0%E6%8D%95%E8%8E%B7%E7%BB%84(capture%C2%A0group)-IT%E4%BF%B1%E4%B9%90%E9%83%A8&desc=%E7%9B%AE%E5%BD%95%201%E3%80%81%E6%A6%82%E8%BF%B0%201.1%20%E4%BB%80%E4%B9%88%E6%98%AF%E6%8D%95%E8%8E%B7%E7%BB%84%201.2%20%E6%8D%95%E8%8E%B7%E7%BB%84%E7%BC%96%E5%8F%B7%E8%A7%84%E5%88%99%201.2.1%20%E6%99%AE%E9%80%9A%E6%8D%95%E8%8E%B7%E7%BB%84%E7%BC%96%E5%8F%B7%E8%A7%84%E5%88%99%201.2.2%C2%A0%C2%A0%E5%91%BD%E2%80%A6&pics=https%3A%2F%2Fwww.2it.club%2Fwp-content%2Fuploads%2F2023%2F07%2Ffrc-8dd91a40df5faa357d5ddf0ca0d63bed.jpg&summary="%E7%9B%AE%E5%BD%95%201%E3%80%81%E6%A6%82%E8%BF%B0%201.1%20%E4%BB%80%E4%B9%88%E6%98%AF%E6%8D%95%E8%8E%B7%E7%BB%84%201.2%20%E6%8D%95%E8%8E%B7%E7%BB%84%E7%BC%96%E5%8F%B7%E8%A7%84%E5%88%99%201.2.1%20%E6%99%AE%E9%80%9A%E6%8D%95%E8%8E%B7%E7%BB%84%E7%BC%96%E5%8F%B7%E8%A7%84%E5%88%99%201.2.2%C2%A0%C2%A0%E5%91%BD%E2%80%A6"" target="_blank"></a><a class="social-share-icon icon-qzone" href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=https%3A%2F%2Fwww.2it.club%2Fnavsub%2Fregex%2F8231.html&title=%E6%AD%A3%E5%88%99%E5%9F%BA%E7%A1%80%E4%B9%8B%C2%A0%E6%8D%95%E8%8E%B7%E7%BB%84(capture%C2%A0group)-IT%E4%BF%B1%E4%B9%90%E9%83%A8&desc=%E7%9B%AE%E5%BD%95%201%E3%80%81%E6%A6%82%E8%BF%B0%201.1%20%E4%BB%80%E4%B9%88%E6%98%AF%E6%8D%95%E8%8E%B7%E7%BB%84%201.2%20%E6%8D%95%E8%8E%B7%E7%BB%84%E7%BC%96%E5%8F%B7%E8%A7%84%E5%88%99%201.2.1%20%E6%99%AE%E9%80%9A%E6%8D%95%E8%8E%B7%E7%BB%84%E7%BC%96%E5%8F%B7%E8%A7%84%E5%88%99%201.2.2%C2%A0%C2%A0%E5%91%BD%E2%80%A6&summary=%E7%9B%AE%E5%BD%95%201%E3%80%81%E6%A6%82%E8%BF%B0%201.1%20%E4%BB%80%E4%B9%88%E6%98%AF%E6%8D%95%E8%8E%B7%E7%BB%84%201.2%20%E6%8D%95%E8%8E%B7%E7%BB%84%E7%BC%96%E5%8F%B7%E8%A7%84%E5%88%99%201.2.1%20%E6%99%AE%E9%80%9A%E6%8D%95%E8%8E%B7%E7%BB%84%E7%BC%96%E5%8F%B7%E8%A7%84%E5%88%99%201.2.2%C2%A0%C2%A0%E5%91%BD%E2%80%A6&site=%E6%AD%A3%E5%88%99%E5%9F%BA%E7%A1%80%E4%B9%8B%C2%A0%E6%8D%95%E8%8E%B7%E7%BB%84(capture%C2%A0group)-IT%E4%BF%B1%E4%B9%90%E9%83%A8" target="_blank"></a></span> </span> </div> <!-- #post-## --> <div class ="post-nav clear "> <div class=" post-nav-previous "><i class=" fa fa-angle-left "></i> 上一篇<a href=" https: //www.2it.club/navsub/regex/8233.html" rel="next">Web 前端常用正则校验规则整理(常用示例)</a></div> <div class="post-nav-next">下一篇 <i class="fa fa-angle-right"></i><a href="https://www.2it.club/navsub/regex/8230.html" rel="prev">正则表达式之字符组[ ](Character Classes)</a></div> </div> <div class ="related-content "> <h3 class=" section-title ">相关推荐</h3> <ul class=" clear "> <li class=" hentry "> <span class=" entry-title "><a href=" https: //www.2it.club/navsub/regex/14694.html">如何使用正则去掉html中标签与标签之间的空格</a></span> <span class ="entry-meta "> <span class=" entry-views "><i class=" flaticon-eye "></i> 352<em>阅读</em></span> </span><!-- .entry-meta --> </li><!-- .featured-slide .hentry --> <li class=" hentry "> <span class=" entry-title "><a href=" https: //www.2it.club/navsub/regex/14685.html">@Pattern 用于校验字符串是否符合特定正则表达式的注解</a></span> <span class ="entry-meta "> <span class=" entry-views "><i class=" flaticon-eye "></i> 360<em>阅读</em></span> </span><!-- .entry-meta --> </li><!-- .featured-slide .hentry --> <li class=" hentry "> <span class=" entry-title "><a href=" https: //www.2it.club/navsub/regex/14677.html">SQL正则表达式错误 “parentheses not balanced“ 问题的排查和解决方案</a></span> <span class ="entry-meta "> <span class=" entry-views "><i class=" flaticon-eye "></i> 336<em>阅读</em></span> </span><!-- .entry-meta --> </li><!-- .featured-slide .hentry --> <li class=" hentry "> <span class=" entry-title "><a href=" https: //www.2it.club/navsub/regex/14668.html">深入理解正则表达式中的 test 和 /[^A-Za-z0-9]/ ️(推荐)</a></span> <span class ="entry-meta "> <span class=" entry-views "><i class=" flaticon-eye "></i> 347<em>阅读</em></span> </span><!-- .entry-meta --> </li><!-- .featured-slide .hentry --> <li class=" hentry "> <span class=" entry-title "><a href=" https: //www.2it.club/navsub/regex/14657.html">scala中正则表达式的使用详解</a></span> <span class ="entry-meta "> <span class=" entry-views "><i class=" flaticon-eye "></i> 364<em>阅读</em></span> </span><!-- .entry-meta --> </li><!-- .featured-slide .hentry --> <li class=" hentry "> <span class=" entry-title "><a href=" https: //www.2it.club/navsub/regex/14638.html">正则表达式高级应用与性能优化记录</a></span> <span class ="entry-meta "> <span class=" entry-views "><i class=" flaticon-eye "></i> 367<em>阅读</em></span> </span><!-- .entry-meta --> </li><!-- .featured-slide .hentry --> </ul><!-- .featured-grid --> </div><!-- .related-content --> <!-- #main --> <!-- .content-wrapper --> <!-- #primary --> <aside id=" secondary " class=" widget-area sidebar "> <div class=" sidebar__inner "> <div id=" block-2 " class=" widget widget_block widget_search "><form role=" search " method=" get " action=" https: //www.2it.club/" class="wp-block-search__button-outside wp-block-search__text-button wp-block-search"><label class="wp-block-search__label" for="wp-block-search__input-1">搜索</label><div class="wp-block-search__inside-wrapper "><input class="wp-block-search__input" id="wp-block-search__input-1" placeholder="" value="" type="search" name="s" required=""><button aria-label="搜索" class="wp-block-search__button wp-element-button" type="submit">搜索</button></div></form></div><div id="happythemes-ad-1" class="widget widget_ad ad-widget"><div class="adwidget"><a href="https://www.tooao.cn/casesubmit" target="_blank"><img class="image " src="https://img.tooao.cn/2022/04/20220420061245114.png" alt="" width="900" height="383" decoding="async"></a></div><h2 class="widget-title">广告</h2></div><div id="categories-2" class="widget widget_categories"><h2 class="widget-title">分类</h2><form action="https://www.2it.club" method="get"><label class="screen-reader-text" for="cat">分类</label><select name="cat" id="cat" class="postform"> <option value="-1 ">选择分类</option> <option class=" level-0 " value=" 389 ">Access</option> <option class=" level-0 " value=" 244 ">Ajax</option> <option class=" level-0 " value=" 55 ">ASP.NET</option> <option class=" level-0 " value=" 51 ">CSS</option> <option class=" level-0 " value=" 768 ">DNS服务器</option> <option class=" level-0 " value=" 767 ">FTP服务器</option> <option class=" level-0 " value=" 48 ">HTML</option> <option class=" level-0 " value=" 50 ">HTML5</option> <option class=" level-0 " value=" 57 ">Java</option> <option class=" level-0 " value=" 53 ">JavaScript</option> <option class=" level-0 " value=" 652 ">Jsp</option> <option class=" level-0 " value=" 763 ">Linux</option> <option class=" level-0 " value=" 384 ">Mariadb</option> <option class=" level-0 " value=" 383 ">MsSql</option> <option class=" level-0 " value=" 382 ">MySql</option> <option class=" level-0 " value=" 765 ">Nginx</option> <option class=" level-0 " value=" 385 ">Oracle</option> <option class=" level-0 " value=" 56 ">PHP</option> <option class=" level-0 " value=" 58 ">Python</option> <option class=" level-0 " value=" 388 ">Redis</option> <option class=" level-0 " value=" 386 ">SQLite</option> <option class=" level-0 " value=" 766 ">Tomcat</option> <option class=" level-0 " value=" 764 ">Windows</option> <option class=" level-0 " value=" 52 ">XML/XSLT</option> <option class=" level-0 " value=" 245 ">正则表达式</option> </select> </form><script type=" text/javascript "> /* <![CDATA[ */ (function() { var dropdown = document.getElementById( " cat " ); function onCatChange() { if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) { dropdown.parentNode.submit(); } } dropdown.onchange = onCatChange; })(); /* ]]> */ </script> </div><div id=" tag_cloud-1 " class=" widget widget_tag_cloud "><h2 class=" widget-title ">热门标签</h2><div class=" tagcloud "><a href=" https: //www.2it.club/tag/c" class="tag-cloud-link tag-link-566 tag-link-position-1" style="font-size: 11.888888888889pt;" aria-label="c (252 项)">c<span class="tag-link-count"> (252)</span></a> <a href="https: //www.2it.club/tag/css" class="tag-cloud-link tag-link-697 tag-link-position-2" style="font-size: 8.1944444444444pt;" aria-label="css (161 项)">css<span class="tag-link-count"> (161)</span></a> <a href="https: //www.2it.club/tag/html" class="tag-cloud-link tag-link-344 tag-link-position-3" style="font-size: 11.111111111111pt;" aria-label="html (230 项)">html<span class="tag-link-count"> (230)</span></a> <a href="https: //www.2it.club/tag/java" class="tag-cloud-link tag-link-63 tag-link-position-4" style="font-size: 15.194444444444pt;" aria-label="java (370 项)">java<span class="tag-link-count"> (370)</span></a> <a href="https: //www.2it.club/tag/linux" class="tag-cloud-link tag-link-332 tag-link-position-5" style="font-size: 14.416666666667pt;" aria-label="linux (339 项)">linux<span class="tag-link-count"> (339)</span></a> <a href="https: //www.2it.club/tag/mongodb" class="tag-cloud-link tag-link-828 tag-link-position-6" style="font-size: 9.1666666666667pt;" aria-label="mongodb (183 项)">mongodb<span class="tag-link-count"> (183)</span></a> <a href="https: //www.2it.club/tag/mysql" class="tag-cloud-link tag-link-59 tag-link-position-7" style="font-size: 17.916666666667pt;" aria-label="mysql (510 项)">mysql<span class="tag-link-count"> (510)</span></a> <a href="https: //www.2it.club/tag/net" class="tag-cloud-link tag-link-628 tag-link-position-8" style="font-size: 11.888888888889pt;" aria-label="net (249 项)">net<span class="tag-link-count"> (249)</span></a> <a href="https: //www.2it.club/tag/nginx" class="tag-cloud-link tag-link-1013 tag-link-position-9" style="font-size: 15.777777777778pt;" aria-label="nginx (395 项)">nginx<span class="tag-link-count"> (395)</span></a> <a href="https: //www.2it.club/tag/oracle" class="tag-cloud-link tag-link-509 tag-link-position-10" style="font-size: 14.805555555556pt;" aria-label="oracle (351 项)">oracle<span class="tag-link-count"> (351)</span></a> <a href="https: //www.2it.club/tag/php" class="tag-cloud-link tag-link-254 tag-link-position-11" style="font-size: 10.722222222222pt;" aria-label="php (218 项)">php<span class="tag-link-count"> (218)</span></a> <a href="https: //www.2it.club/tag/python" class="tag-cloud-link tag-link-174 tag-link-position-12" style="font-size: 16.75pt;" aria-label="python (449 项)">python<span class="tag-link-count"> (449)</span></a> <a href="https: //www.2it.club/tag/redis" class="tag-cloud-link tag-link-827 tag-link-position-13" style="font-size: 15.583333333333pt;" aria-label="redis (387 项)">redis<span class="tag-link-count"> (387)</span></a> <a href="https: //www.2it.club/tag/server" class="tag-cloud-link tag-link-420 tag-link-position-14" style="font-size: 15.777777777778pt;" aria-label="server (394 项)">server<span class="tag-link-count"> (394)</span></a> <a href="https: //www.2it.club/tag/springboot" class="tag-cloud-link tag-link-75 tag-link-position-15" style="font-size: 10.722222222222pt;" aria-label="springboot (219 项)">springboot<span class="tag-link-count"> (219)</span></a> <a href="https: //www.2it.club/tag/sql" class="tag-cloud-link tag-link-395 tag-link-position-16" style="font-size: 16.75pt;" aria-label="sql (441 项)">sql<span class="tag-link-count"> (441)</span></a> <a href="https: //www.2it.club/tag/tomcat" class="tag-cloud-link tag-link-769 tag-link-position-17" style="font-size: 8pt;" aria-label="tomcat (159 项)">tomcat<span class="tag-link-count"> (159)</span></a> <a href="https: //www.2it.club/tag/vue" class="tag-cloud-link tag-link-1115 tag-link-position-18" style="font-size: 12.666666666667pt;" aria-label="vue (275 项)">vue<span class="tag-link-count"> (275)</span></a> <a href="https: //www.2it.club/tag/windows" class="tag-cloud-link tag-link-447 tag-link-position-19" style="font-size: 10.527777777778pt;" aria-label="windows (214 项)">windows<span class="tag-link-count"> (214)</span></a> <a href="https: //www.2it.club/tag/%e4%bb%a3%e7%a0%81" class="tag-cloud-link tag-link-211 tag-link-position-20" style="font-size: 9.9444444444444pt;" aria-label="代码 (200 项)">代码<span class="tag-link-count"> (200)</span></a> <a href="https: //www.2it.club/tag/%e4%bd%bf%e7%94%a8" class="tag-cloud-link tag-link-182 tag-link-position-21" style="font-size: 11.111111111111pt;" aria-label="使用 (228 项)">使用<span class="tag-link-count"> (228)</span></a> <a href="https: //www.2it.club/tag/%e5%ae%9e%e7%8e%b0" class="tag-cloud-link tag-link-219 tag-link-position-22" style="font-size: 12.277777777778pt;" aria-label="实现 (262 项)">实现<span class="tag-link-count"> (262)</span></a> <a href="https: //www.2it.club/tag/%e6%95%99%e7%a8%8b" class="tag-cloud-link tag-link-68 tag-link-position-23" style="font-size: 9.3611111111111pt;" aria-label="教程 (186 项)">教程<span class="tag-link-count"> (186)</span></a> <a href="https: //www.2it.club/tag/%e6%95%b0%e6%8d%ae%e5%ba%93" class="tag-cloud-link tag-link-404 tag-link-position-24" style="font-size: 13.25pt;" aria-label="数据库 (295 项)">数据库<span class="tag-link-count"> (295)</span></a> <a href="https: //www.2it.club/tag/%e6%96%b9%e6%b3%95" class="tag-cloud-link tag-link-126 tag-link-position-25" style="font-size: 11.888888888889pt;" aria-label="方法 (249 项)">方法<span class="tag-link-count"> (249)</span></a> <a href="https: //www.2it.club/tag/%e6%9c%8d%e5%8a%a1%e5%99%a8" class="tag-cloud-link tag-link-452 tag-link-position-26" style="font-size: 10.333333333333pt;" aria-label="服务器 (207 项)">服务器<span class="tag-link-count"> (207)</span></a> <a href="https: //www.2it.club/tag/%e6%ad%a5%e9%aa%a4" class="tag-cloud-link tag-link-87 tag-link-position-27" style="font-size: 10.138888888889pt;" aria-label="步骤 (201 项)">步骤<span class="tag-link-count"> (201)</span></a> <a href="https: //www.2it.club/tag/%e7%a4%ba%e4%be%8b" class="tag-cloud-link tag-link-62 tag-link-position-28" style="font-size: 16.75pt;" aria-label="示例 (442 项)">示例<span class="tag-link-count"> (442)</span></a> <a href="https: //www.2it.club/tag/%e8%af%a6%e8%a7%a3" class="tag-cloud-link tag-link-65 tag-link-position-29" style="font-size: 22pt;" aria-label="详解 (832 项)">详解<span class="tag-link-count"> (832)</span></a> <a href="https: //www.2it.club/tag/%e9%85%8d%e7%bd%ae" class="tag-cloud-link tag-link-120 tag-link-position-30" style="font-size: 8pt;" aria-label="配置 (158 项)">配置<span class="tag-link-count"> (158)</span></a></div> </div> </div><!-- .sidebar__inner --> </aside><!-- #secondary --> <!-- #content .site-content --> <footer id="colophon " class=" site-footer clear "> <div class=" clear "></div> <div id=" site-bottom " class=" clear "> <div class=" container "> <div class=" menu-posts-container "><ul id=" footer-menu " class=" footer-nav "><li id=" menu-item-13384 " class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-13384 "><a href=" https: //www.jinansoftware.com/">济南APP开发</a></li> <li id="menu-item-13385 " class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-13385 "><a href=" https: //www.tooao.com.cn/">济南小程序开发</a></li> <li id="menu-item-13386 " class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-13386 "><a href=" https: //www.tooao.cn">济南软件开发</a></li> </ul></div> <div class ="site-info "> © 2023 <a href=" https: //www.2it.club">IT俱乐部</a> - 从此刻爱上编程 <a href="https://beian.miit.gov.cn/" target="_blank">鲁ICP备17035389号-4</a> <script> var _hmt = _hmt || []; ( function () { var hm = document.createElement("script "); hm.src = " https: //hm.baidu.com/hm.js?aaf3c61cf6931a6a93916175e3d4f201"; var s = document.getElementsByTagName("script ")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </div><!-- .site-info --> </div><!-- .container --> </div> <!-- #site-bottom --> </footer><!-- #colophon --> <!-- #page --> <div class=" bottom-right "> <div class=" icon-contact tooltip bottom-icon "> <span class=" icon-link "> <span class=" icon "><i class=" fa fa-phone "></i></span> <span class=" text ">联系我们</span> </span> <div class=" left-space "> <div class=" left "> <div class=" contact-info "> <h3>联系我们</h3> <p>在线咨询: <a href=" http: //wpa.qq.com/msgrd?v=3&uin=1120393934&site=qq&menu=yes" target="_blank"><img src="https://www.2it.club/wp-content/themes/iux/assets/img/qqchat.gif" alt="QQ交谈"></a></p> <p>邮箱: 1120393934@qq.com</p> <p>工作时间:周一至周五,9:00-17:30,节假日休息</p> </div> <i></i> </div> </div> </div> <div class ="icon-weixin tooltip bottom-icon "> <span class=" icon-link "> <span class=" icon "><i class=" fa fa-wechat "></i></span> <span class=" text ">关注微信</span> </span> <div class=" left-space "> <div class=" left "> <img src=" https: //www.2it.club/wp-content/uploads/2024/10/微信图片_20220921160855.jpg" alt="微信扫一扫关注我们"> <h3>微信扫一扫关注我们</h3> <i></i> </div> </div> </div> <div id="back-top " class=" bottom-icon "> <a href=" #top" title="返回顶部"> <span class ="icon "><i class=" fa fa-chevron-up "></i></span> <span class=" text ">返回顶部</span> </a> </div> </div><!-- .bottom-right --> <script type=" speculationrules "> {" prefetch ":[{" source ":" document "," where ":{" and ":[{" href_matches ":" \ /*"},{"not":{"href_matches":["\/wp-*.php","\/wp-admin\/*","\/wp-content\/uploads\/*","\/wp-content\/*","\/wp-content\/plugins\/*","\/wp-content\/themes\/iux\/*","\/*\\?(.+)"]}},{"not":{"selector_matches":"a[rel~=\"nofollow\"]"}},{"not":{"selector_matches":".no-prefetch, .no-prefetch a"}}]},"eagerness":"conservative"}]} </script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shCore.js?ver=3.0.9b" id="syntaxhighlighter-core-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushAS3.js?ver=3.0.9b" id="syntaxhighlighter-brush-as3-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushArduino.js?ver=3.0.9b" id="syntaxhighlighter-brush-arduino-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushBash.js?ver=3.0.9b" id="syntaxhighlighter-brush-bash-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushColdFusion.js?ver=3.0.9b" id="syntaxhighlighter-brush-coldfusion-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/third-party-brushes/shBrushClojure.js?ver=20090602" id="syntaxhighlighter-brush-clojure-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushCpp.js?ver=3.0.9b" id="syntaxhighlighter-brush-cpp-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushCSharp.js?ver=3.0.9b" id="syntaxhighlighter-brush-csharp-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushCss.js?ver=3.0.9b" id="syntaxhighlighter-brush-css-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushDelphi.js?ver=3.0.9b" id="syntaxhighlighter-brush-delphi-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushDiff.js?ver=3.0.9b" id="syntaxhighlighter-brush-diff-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushErlang.js?ver=3.0.9b" id="syntaxhighlighter-brush-erlang-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/third-party-brushes/shBrushFSharp.js?ver=20091003" id="syntaxhighlighter-brush-fsharp-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushGo.js?ver=3.0.9b" id="syntaxhighlighter-brush-go-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushGroovy.js?ver=3.0.9b" id="syntaxhighlighter-brush-groovy-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushHaskell.js?ver=3.0.9b" id="syntaxhighlighter-brush-haskell-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushJava.js?ver=3.0.9b" id="syntaxhighlighter-brush-java-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushJavaFX.js?ver=3.0.9b" id="syntaxhighlighter-brush-javafx-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushJScript.js?ver=3.0.9b" id="syntaxhighlighter-brush-jscript-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/third-party-brushes/shBrushLatex.js?ver=20090613" id="syntaxhighlighter-brush-latex-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/third-party-brushes/shBrushMatlabKey.js?ver=20091209" id="syntaxhighlighter-brush-matlabkey-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/third-party-brushes/shBrushObjC.js?ver=20091207" id="syntaxhighlighter-brush-objc-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushPerl.js?ver=3.0.9b" id="syntaxhighlighter-brush-perl-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushPhp.js?ver=3.0.9b" id="syntaxhighlighter-brush-php-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushPlain.js?ver=3.0.9b" id="syntaxhighlighter-brush-plain-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushPowerShell.js?ver=3.0.9b" id="syntaxhighlighter-brush-powershell-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushPython.js?ver=3.0.9b" id="syntaxhighlighter-brush-python-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/third-party-brushes/shBrushR.js?ver=20100919" id="syntaxhighlighter-brush-r-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushRuby.js?ver=3.0.9b" id="syntaxhighlighter-brush-ruby-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushScala.js?ver=3.0.9b" id="syntaxhighlighter-brush-scala-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushSql.js?ver=3.0.9b" id="syntaxhighlighter-brush-sql-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushSwift.js?ver=3.0.9b" id="syntaxhighlighter-brush-swift-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushVb.js?ver=3.0.9b" id="syntaxhighlighter-brush-vb-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushXml.js?ver=3.0.9b" id="syntaxhighlighter-brush-xml-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushYaml.js?ver=3.0.9b" id="syntaxhighlighter-brush-yaml-js"></script> <script type="text/javascript"> (function(){ var corecss = document.createElement('link'); var themecss = document.createElement('link'); var corecssurl = "https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shCore.css?ver=3.0.9b"; if ( corecss.setAttribute ) { corecss.setAttribute( "rel", "stylesheet" ); corecss.setAttribute( "type", "text/css" ); corecss.setAttribute( "href", corecssurl ); } else { corecss.rel = "stylesheet"; corecss.href = corecssurl; } document.head.appendChild( corecss ); var themecssurl = "https://www.2it.club/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shThemeRDark.css?ver=3.0.9b"; if ( themecss.setAttribute ) { themecss.setAttribute( "rel", "stylesheet" ); themecss.setAttribute( "type", "text/css" ); themecss.setAttribute( "href", themecssurl ); } else { themecss.rel = "stylesheet"; themecss.href = themecssurl; } document.head.appendChild( themecss ); })(); SyntaxHighlighter.config.strings.expandSource = '+ expand source'; SyntaxHighlighter.config.strings.help = '?'; SyntaxHighlighter.config.strings.alert = 'SyntaxHighlighter\n\n'; SyntaxHighlighter.config.strings.noBrush = 'Can\'t find brush for: '; SyntaxHighlighter.config.strings.brushNotHtmlScript = 'Brush wasn\'t configured for html-script option: '; SyntaxHighlighter.defaults['pad-line-numbers'] = false; SyntaxHighlighter.defaults['toolbar'] = false; SyntaxHighlighter.all(); // Infinite scroll support if ( typeof( jQuery ) !== 'undefined' ) { jQuery( function( $ ) { $( document.body ).on( 'post-load', function() { SyntaxHighlighter.highlight(); } ); } ); } </script> <script type="text/javascript" src="https://www.2it.club/wp-content/themes/iux/assets/js/superfish.js?ver=6.8.1" id="superfish-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/themes/iux/assets/js/jquery.slicknav.js?ver=6.8.1" id="slicknav-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/themes/iux/assets/js/modernizr.js?ver=6.8.1" id="modernizr-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/themes/iux/assets/js/html5.js?ver=6.8.1" id="html5-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/themes/iux/assets/js/jquery.bxslider.js?ver=6.8.1" id="bxslider-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/themes/iux/assets/js/index.js?ver=20200320" id="index-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/themes/iux/assets/js/qrcode.js?ver=6.8.1" id="qrcode-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/themes/iux/assets/js/social-share.js?ver=6.8.1" id="social-share-js"></script> <script type="text/javascript" src="https://www.2it.club/wp-content/themes/iux/assets/js/jquery.custom.js?ver=20220101" id="iux-custom-js"></script> <script> /(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1); </script> <script> (function($){ //create closure so we can safely use $ as alias for jQuery $(document).ready(function(){ "use strict"; /*-----------------------------------------------------------------------------------*/ /* Slick Mobile Menu /*-----------------------------------------------------------------------------------*/ $( '#primary-menu' ).slicknav({ prependTo: '#slick-mobile-menu' , allowParentLinks: true , label: '导航' }); }); })(jQuery); </script> <script> ( function ($){ //create closure so we can safely use $ as alias for jQuery $(document).ready( function (){ "use strict" ; $(window).load( function () { var stickySidebar = new StickySidebar( '#secondary' , { topSpacing: 20, bottomSpacing: 20, containerSelector: '.site_container' , innerWrapperSelector: '.sidebar__inner' }); }); }); })(jQuery); </script> <script> ( function ($){ //create closure so we can safely use $ as alias for jQuery $(document).ready( function (){ "use strict" ; if ($(window).width() >= 960) { var mn = $( ".site-header" ); var mns = "main-nav-scrolled" ; var hdr = $( '.top-bar' ).height(); $(window).scroll( function () { if ( $( this ).scrollTop() > hdr ) { mn.addClass(mns); $( '.header-space' ).css( 'display' , 'block' ); } else { mn.removeClass(mns); $( '.header-space' ).css( 'display' , 'none' ); } }); } }); })(jQuery); </script> <!-- Dynamic page generated in 0.399 seconds. --> <!-- Cached page generated by WP-Super-Cache on 2025-06-20 07:35:34 --> <!-- Compression = gzip --></td></tr></tbody></table> |