Home Backend Development PHP Tutorial jQuery+Ajax+PHP implements 'like' rating function code_PHP tutorial

jQuery+Ajax+PHP implements 'like' rating function code_PHP tutorial

Jul 20, 2016 am 11:11 AM
introduce code Function like accomplish article Rating

This article will introduce to you a jQuery+Ajax+PHP code to implement the "like" rating function. When the user clicks the red heart button on the picture he likes on the page, the front-end page sends an ajax request to the background. After the background PHP program receives the request, Check whether there is already a click record of the user in the IP library. If not, add the corresponding value by 1 and write the user's IP information into the IP library. Otherwise, the user will be told that he has "liked it".


Database design

First prepare two tables. The pic table saves picture information, including the name, path and total number of "likes" of the picture. Pic_ip records the user's clicks on likes. IP data.

CREATE TABLE IF NOT EXISTS `pic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pic_name` varchar(60) NOT NULL,
`pic_url` varchar( 60) NOT NULL,
`love` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `pic_ip` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pic_id` int(11) NOT NULL,
`ip` varchar(40) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

index.php

In index.php, we pass PHP Read the image information in the pic table and display it, combined with CSS, to improve the page display effect.

The code is as follows Copy code
 代码如下 复制代码







jQuery+Ajax+PHP实现"喜欢"评级





    include_once("connect.php");
    $sql = mysql_query("select * from pic");
    while($row=mysql_fetch_array($sql)){
    $pic_id = $row['id'];
    $pic_name = $row['pic_name'];
    $pic_url = $row['pic_url'];
    $love = $row['love'];
    ?>
  • <?php echo $pic_name;?>




< meta name="keywords" content="jquery">jQuery+Ajax+PHP to achieve "like" rating</ title><link rel="stylesheet" type="text/css" href="../css/main.css" /><script type="text/javascript" src= "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script type="text/javascript">$(function(){$("p a").click(function(){var love = $(this);var id = love.attr("rel"); love.fadeOut(300);$.ajax({type:"POST",url:"love.php",data:"id="+id, cache:false,success:function(data){love.html(data);love.fadeIn(300);}}); return false;});});</script><style type="text/css">.clear{clear:both}.list{width:760px; margin:20px auto}.list li{float:left; width:360px; height:280px; margin:10px; position:relative}.list li p{position: absolute; top:0; left:0; width:360px; height:24px; line-height:24px; background:#000; opacity:.8;filter:alpha(opacity=80);}.list li p a{padding-left:30px; height:24px; background:url(images/heart.png) no-repeat 4px -1px;color:#fff; font-weight:bold; font-size:14px}. list li p a:hover{background-position:4px -25px;text-decoration:none}</style></head><body><div id="main"><ul class="list"><?php<🎜>include_once("connect.php");<🎜> $sql = mysql_query("select * from pic");<🎜>while($row=mysql_fetch_array($sql)){<🎜>$pic_id = $row['id'];<🎜>$pic_name = $row ['pic_name'];<🎜>$pic_url = $row['pic_url'];<🎜>$love = $row['love'];<🎜>?><li><img src="images/<?php echo $pic_url;?>" alt="<?php echo $pic_name;?>"><p><a href="#" title="Me Like" class="img_on" rel="<?php echo $pic_id;?>"><?php echo $love;?></a></p></li> <?php }?></ul></div></body></html></td> </tr> </table> <p>In CSS, we will define the dynamic effect of the mouse sliding towards and away from the red heart button, and position the button. </p> <table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> The code is as follows</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy8372 ')">Copy code</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id="copy8372"> <table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy8372')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id="copy8372"><p>.list{width:760px; margin:20px auto} <br>.list li{float:left; width:360px; height:280px; margin:10px; position:relative} <br>.list li p{position:absolute; top:0; left:0; width:360px; height:24px; line-height:24px;  <br>background:#000; opacity:.8;filter:alpha(opacity=80);} <br>.list li p a{padding-left:30px; height:24px; background:url(images/heart.png) no-repeat  <br>4px -1px;color:#fff; font-weight:bold; font-size:14px} <br>.list li p a:hover{background-position:4px -25px;text-decoration:none} </p></td> </tr> </table>.list{width:760px; margin:20px auto} <br>.list li{float:left; width:360px; height:280px; margin:10px; position:relative} <br>.list li p{position:absolute; top:0; left:0; width:360px; height:24px; line-height:24px; <br>background:#000; opacity:.8;filter :alpha(opacity=80);} <br>.list li p a{padding-left:30px; height:24px; background:url(images/heart.png) no-repeat <br>4px -1px; color:#fff; font-weight:bold; font-size:14px} <br>.list li p a:hover{background-position:4px -25px;text-decoration:none} <p></p> </td> </tr> </table>jQuery code<p></p>When the user clicks the red heart button on the picture he likes, an ajax request is sent to the background love.php. After the request response is successful, the original is updated. numerical value. <table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy9358')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id="copy9358"><p>$(function(){ <br>    $("p a").click(function(){ <br>        var love = $(this); <br>        var id = love.attr("rel"); //对应id <br>        love.fadeOut(300); //渐隐效果 <br>        $.ajax({ <br>            type:"POST", <br>            url:"love.php", <br>            data:"id="+id, <br>            cache:false, //不缓存此页面 <br>            success:function(data){ <br>                love.html(data); <br>                love.fadeIn(300); //渐显效果 <br>            } <br>        }); <br>        return false; <br>    }); <br>}); </p></td> </tr> </table> <table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> The code is as follows</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy9358 ')">Copy code</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id="copy9358">$(function(){ <br> $("p a").click(function(){ <br> var love = $(this); <br> var id = love.attr("rel"); //corresponding id <br> love.fadeOut(300); //fade out effect <br> $.ajax({ <br> type: "POST" , <br> url: "love.php", <br> data: "id ="+id, <br> cache: false, // not cache this page <br> SUCCESS: Function (data) { <br>                 love.html(data); > }); <br>}); </td> </tr> </table> <p>love.php</p> <p>The background love.php receives the ajax request from the front end, and based on the submitted image id value, checks whether there is a click record of the user's IP in the IP table. If so, it tells the user that it has been " "I liked it", otherwise, perform the following operations: </p> <p> 1. Update the corresponding image love field value in the image table and add 1 to the value. </p> <p>2. Write the user’s IP information into the pic_ip table to prevent users from clicking repeatedly. </p> <p>3. Get the updated love value, which is the total number of users who like the picture, and output the total to the front-end page. </p> <table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> The code is as follows<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy8135')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id="copy8135"> <p><?php<br />$host="localhost";<br />$db_user="root";<br />$db_pass="";<br />$db_name="demo";<br />$timezone="Asia/Shanghai";</p><p>$link=mysql_connect($host,$db_user,$db_pass);<br />mysql_select_db($db_name,$link);<br />mysql_query("SET names UTF8");<br />?></p> <p> </p> <p> </p> <p><?php<br />include_once("connect.php");</p><p>$ip = get_client_ip();<br />$id = $_POST['id'];<br />if(!isset($id) || empty($id)) exit;</p><p>$ip_sql=mysql_query("select ip from pic_ip where pic_id='$id' and ip='$ip'");<br />$count=mysql_num_rows($ip_sql);<br />if($count==0){<br />$sql = "update pic set love=love+1 where id='$id'";<br />mysql_query( $sql);<br />$sql_in = "insert into pic_ip (pic_id,ip) values ('$id','$ip')";<br />mysql_query( $sql_in);<br />$result = mysql_query("select love from pic where id='$id'");<br />$row = mysql_fetch_array($result);<br />$love = $row['love'];<br />echo $love;<br />}else{<br />echo "喜欢过了..";<br />}</p><p>//获取用户真实IP<br />function get_client_ip() {<br />if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))<br />$ip = getenv("HTTP_CLIENT_IP");<br />else<br />if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))<br />$ip = getenv("HTTP_X_FORWARDED_FOR");<br />else<br />if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))<br />$ip = getenv("REMOTE_ADDR");<br />else<br />if (isset ($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))<br />$ip = $_SERVER['REMOTE_ADDR'];<br />else<br />$ip = "unknown";<br />return ($ip);<br />}<br />?></p> </td> </tr> </table> </td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy8135' )">Copy code<p> <br> </p> </td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id="copy8135"><?php</td>$host="localhost";</tr>$db_user="root";</table>$db_pass="";<br>$db_name="demo"; </p>$timezone="Asia/Shanghai";<p align="left"><div style="display:none;">$link=mysql_connect($host,$db_user,$db_pass);<span id="url" itemprop="url">mysql_select_db($db_name,$link);</span>mysql_query( "SET names UTF8");<span id="indexUrl" itemprop="indexUrl">?><span id="isOriginal" itemprop="isOriginal"> </span><span id="isBasedOnUrl" itemprop="isBasedOnUrl"> </span><span id="genre" itemprop="genre"><?php</span>include_once("connect.php");<span id="description" itemprop="description"> </span>$ip = get_client_ip();</div>$id = $_POST['id'];</p>if(!isset($id) || empty($id)) exit;</div><div class="art_confoot">$ip_sql=mysql_query("select ip from pic_ip where pic_id='$id' and ip='$ip'");</div>$count=mysql_num_rows($ip_sql);<🎜>if($count==0 ){<🎜>$sql = "update pic set love=love+1 where id='$id'";<🎜>mysql_query( $sql);<🎜>$sql_in = "insert into pic_ip (pic_id,ip) values ​​('$id','$ip')";<🎜>mysql_query( $sql_in);<🎜>$result = mysql_query("select love from pic where id='$id'");<🎜>$ row = mysql_fetch_array($result);<🎜>$love = $row['love'];<🎜>echo $love;<🎜>}else{<🎜>echo "I liked it..";<🎜> }<🎜><🎜>//Get the user’s real IP<🎜>function get_client_ip() {<🎜>if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))<🎜> $ip = getenv("HTTP_CLIENT_IP");<🎜>else<🎜>if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))<🎜>$ip = getenv("HTTP_X_FORWARDED_FOR" ");<🎜>else<🎜>if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))<🎜>$ip = getenv("REMOTE_ADDR");<🎜>else <🎜>if (isset ($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))<🎜>$ip = $_SERVER['REMOTE_ADDR '];<🎜>else<🎜>$ip = "unknown";<🎜>return ($ip);<🎜>}<🎜>?> The get_client_ip() function in the code is used to obtain the user’s real IP http://www.bkjia.com/PHPjc/444603.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444603.htmlTechArticleThis article will introduce to you a jQuery+Ajax+PHP code to implement the "like" rating function. Users click on the page When you click the red heart button on the picture you like, the front-end page sends a message to the background... </span> </td> </tr> </table> </div> </div> <div class="wzconShengming_sp"> <div class="bzsmdiv_sp">Statement of this Website</div> <div>The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn</div> </div> </div> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5902227090019525" data-ad-slot="2507867629"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <div class="AI_ToolDetails_main4sR"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5902227090019525" data-ad-slot="3653428331" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <!-- <div class="phpgenera_Details_mainR4"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hotarticle2.png" alt="" /> <h2>Hot Article</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/1796797907.html" title="Roblox: Grow A Garden - Complete Mutation Guide" class="phpgenera_Details_mainR4_bottom_title">Roblox: Grow A Garden - Complete Mutation Guide</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 weeks ago</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/1796797130.html" title="Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys" class="phpgenera_Details_mainR4_bottom_title">Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 weeks ago</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/1796796771.html" title="How to fix KB5055612 fails to install in Windows 10?" class="phpgenera_Details_mainR4_bottom_title">How to fix KB5055612 fails to install in Windows 10?</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 weeks ago</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/1796796926.html" title="Nordhold: Fusion System, Explained" class="phpgenera_Details_mainR4_bottom_title">Nordhold: Fusion System, Explained</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 weeks ago</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/1796797896.html" title="Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook" class="phpgenera_Details_mainR4_bottom_title">Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 weeks ago</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/article.html">Show More</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/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hottools2.png" alt="" /> <h2>Hot AI Tools</h2> </div> <div class="phpgenera_Details_mainR3_bottom"> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/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://www.php.cn/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_title"> <h3>Undresser.AI Undress</h3> </a> <p>AI-powered app for creating realistic nude photos</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/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://www.php.cn/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_title"> <h3>AI Clothes Remover</h3> </a> <p>Online AI tool for removing clothes from photos.</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/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://www.php.cn/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_title"> <h3>Undress AI Tool</h3> </a> <p>Undress images for free</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/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://www.php.cn/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_title"> <h3>Clothoff.io</h3> </a> <p>AI clothes remover</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ai/video-swap" title="Video Face Swap" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173414504068133.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Video Face Swap" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ai/video-swap" title="Video Face Swap" class="phpmain_tab2_mids_title"> <h3>Video Face Swap</h3> </a> <p>Swap faces in any video effortlessly with our completely free AI face swap tool!</p> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ai">Show More</a> </div> </div> </div> <script src="https://sw.php.cn/hezuo/cac1399ab368127f9b113b14eb3316d0.js" type="text/javascript"></script> <div class="phpgenera_Details_mainR4"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hotarticle2.png" alt="" /> <h2>Hot Article</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/1796797907.html" title="Roblox: Grow A Garden - Complete Mutation Guide" class="phpgenera_Details_mainR4_bottom_title">Roblox: Grow A Garden - Complete Mutation Guide</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 weeks ago</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/1796797130.html" title="Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys" class="phpgenera_Details_mainR4_bottom_title">Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 weeks ago</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/1796796771.html" title="How to fix KB5055612 fails to install in Windows 10?" class="phpgenera_Details_mainR4_bottom_title">How to fix KB5055612 fails to install in Windows 10?</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 weeks ago</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/1796796926.html" title="Nordhold: Fusion System, Explained" class="phpgenera_Details_mainR4_bottom_title">Nordhold: Fusion System, Explained</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 weeks ago</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/1796797896.html" title="Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook" class="phpgenera_Details_mainR4_bottom_title">Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 weeks ago</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/article.html">Show More</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/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hottools2.png" alt="" /> <h2>Hot Tools</h2> </div> <div class="phpgenera_Details_mainR3_bottom"> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/toolset/development-tools/92" title="Notepad++7.3.1" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab96f0f39f7357.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="Notepad++7.3.1" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/toolset/development-tools/92" title="Notepad++7.3.1" class="phpmain_tab2_mids_title"> <h3>Notepad++7.3.1</h3> </a> <p>Easy-to-use and free code editor</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/toolset/development-tools/93" title="SublimeText3 Chinese version" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab97a3baad9677.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="SublimeText3 Chinese version" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/toolset/development-tools/93" title="SublimeText3 Chinese version" class="phpmain_tab2_mids_title"> <h3>SublimeText3 Chinese version</h3> </a> <p>Chinese version, very easy to use</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/toolset/development-tools/121" title="Zend Studio 13.0.1" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab97ecd1ab2670.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="Zend Studio 13.0.1" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/toolset/development-tools/121" title="Zend Studio 13.0.1" class="phpmain_tab2_mids_title"> <h3>Zend Studio 13.0.1</h3> </a> <p>Powerful PHP integrated development environment</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/toolset/development-tools/469" title="Dreamweaver CS6" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58d0e0fc74683535.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="Dreamweaver CS6" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/toolset/development-tools/469" title="Dreamweaver CS6" class="phpmain_tab2_mids_title"> <h3>Dreamweaver CS6</h3> </a> <p>Visual web development tools</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/toolset/development-tools/500" title="SublimeText3 Mac version" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58d34035e2757995.png?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="SublimeText3 Mac version" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/toolset/development-tools/500" title="SublimeText3 Mac version" class="phpmain_tab2_mids_title"> <h3>SublimeText3 Mac version</h3> </a> <p>God-level code editing software (SublimeText3)</p> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ai">Show More</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/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hotarticle2.png" alt="" /> <h2>Hot Topics</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/java-tutorial" title="Java Tutorial" class="phpgenera_Details_mainR4_bottom_title">Java Tutorial</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>1666</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>14</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/cakephp-tutor" title="CakePHP Tutorial" class="phpgenera_Details_mainR4_bottom_title">CakePHP Tutorial</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>1426</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>52</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/laravel-tutori" title="Laravel Tutorial" class="phpgenera_Details_mainR4_bottom_title">Laravel Tutorial</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>1328</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>25</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/php-tutorial" title="PHP Tutorial" class="phpgenera_Details_mainR4_bottom_title">PHP Tutorial</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>1273</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>29</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/faq/c-tutorial" title="C# Tutorial" class="phpgenera_Details_mainR4_bottom_title">C# Tutorial</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>1253</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>24</span> </div> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/faq/zt">Show More</a> </div> </div> </div> </div> </div> <div class="Article_Details_main2"> <div class="phpgenera_Details_mainL4"> <div class="phpmain1_2_top"> <a href="javascript:void(0);" class="phpmain1_2_top_title">Related knowledge<img src="/static/imghw/index2_title2.png" alt="" /></a> </div> <div class="phpgenera_Details_mainL4_info"> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/faq/720815.html" title="The difference between vivox100s and x100: performance comparison and function analysis" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/000/164/171120402421258.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="The difference between vivox100s and x100: performance comparison and function analysis" /> </a> <a href="https://www.php.cn/faq/720815.html" title="The difference between vivox100s and x100: performance comparison and function analysis" class="phphistorical_Version2_mids_title">The difference between vivox100s and x100: performance comparison and function analysis</a> <span class="Articlelist_txts_time">Mar 23, 2024 pm 10:27 PM</span> <p class="Articlelist_txts_p">Both vivox100s and x100 mobile phones are representative models in vivo's mobile phone product line. They respectively represent vivo's high-end technology level in different time periods. Therefore, the two mobile phones have certain differences in design, performance and functions. This article will conduct a detailed comparison between these two mobile phones in terms of performance comparison and function analysis to help consumers better choose the mobile phone that suits them. First, let’s look at the performance comparison between vivox100s and x100. vivox100s is equipped with the latest</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/faq/721019.html" title="How to implement dual WeChat login on Huawei mobile phones?" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/465/014/171125082599656.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How to implement dual WeChat login on Huawei mobile phones?" /> </a> <a href="https://www.php.cn/faq/721019.html" title="How to implement dual WeChat login on Huawei mobile phones?" class="phphistorical_Version2_mids_title">How to implement dual WeChat login on Huawei mobile phones?</a> <span class="Articlelist_txts_time">Mar 24, 2024 am 11:27 AM</span> <p class="Articlelist_txts_p">How to implement dual WeChat login on Huawei mobile phones? With the rise of social media, WeChat has become one of the indispensable communication tools in people's daily lives. However, many people may encounter a problem: logging into multiple WeChat accounts at the same time on the same mobile phone. For Huawei mobile phone users, it is not difficult to achieve dual WeChat login. This article will introduce how to achieve dual WeChat login on Huawei mobile phones. First of all, the EMUI system that comes with Huawei mobile phones provides a very convenient function - dual application opening. Through the application dual opening function, users can simultaneously</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/faq/717375.html" title="What exactly is self-media? What are its main features and functions?" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/000/164/171102368571134.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="What exactly is self-media? What are its main features and functions?" /> </a> <a href="https://www.php.cn/faq/717375.html" title="What exactly is self-media? What are its main features and functions?" class="phphistorical_Version2_mids_title">What exactly is self-media? What are its main features and functions?</a> <span class="Articlelist_txts_time">Mar 21, 2024 pm 08:21 PM</span> <p class="Articlelist_txts_p">With the rapid development of the Internet, the concept of self-media has become deeply rooted in people's hearts. So, what exactly is self-media? What are its main features and functions? Next, we will explore these issues one by one. 1. What exactly is self-media? We-media, as the name suggests, means you are the media. It refers to an information carrier through which individuals or teams can independently create, edit, publish and disseminate content through the Internet platform. Different from traditional media, such as newspapers, television, radio, etc., self-media is more interactive and personalized, allowing everyone to become a producer and disseminator of information. 2. What are the main features and functions of self-media? 1. Low threshold: The rise of self-media has lowered the threshold for entering the media industry. Cumbersome equipment and professional teams are no longer needed.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/faq/715290.html" title="PHP Programming Guide: Methods to Implement Fibonacci Sequence" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/000/164/171092485154394.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="PHP Programming Guide: Methods to Implement Fibonacci Sequence" /> </a> <a href="https://www.php.cn/faq/715290.html" title="PHP Programming Guide: Methods to Implement Fibonacci Sequence" class="phphistorical_Version2_mids_title">PHP Programming Guide: Methods to Implement Fibonacci Sequence</a> <span class="Articlelist_txts_time">Mar 20, 2024 pm 04:54 PM</span> <p class="Articlelist_txts_p">The programming language PHP is a powerful tool for web development, capable of supporting a variety of different programming logics and algorithms. Among them, implementing the Fibonacci sequence is a common and classic programming problem. In this article, we will introduce how to use the PHP programming language to implement the Fibonacci sequence, and attach specific code examples. The Fibonacci sequence is a mathematical sequence defined as follows: the first and second elements of the sequence are 1, and starting from the third element, the value of each element is equal to the sum of the previous two elements. The first few elements of the sequence</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/faq/719582.html" title="How to use Copilot to generate code" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/887/227/171116169829222.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How to use Copilot to generate code" /> </a> <a href="https://www.php.cn/faq/719582.html" title="How to use Copilot to generate code" class="phphistorical_Version2_mids_title">How to use Copilot to generate code</a> <span class="Articlelist_txts_time">Mar 23, 2024 am 10:41 AM</span> <p class="Articlelist_txts_p">As a programmer, I get excited about tools that simplify the coding experience. With the help of artificial intelligence tools, we can generate demo code and make necessary modifications as per the requirement. The newly introduced Copilot tool in Visual Studio Code allows us to create AI-generated code with natural language chat interactions. By explaining functionality, we can better understand the meaning of existing code. How to use Copilot to generate code? To get started, we first need to get the latest PowerPlatformTools extension. To achieve this, you need to go to the extension page, search for &quot;PowerPlatformTool&quot; and click the Install button</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/faq/716942.html" title="What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account?" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/887/227/171100899550320.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account?" /> </a> <a href="https://www.php.cn/faq/716942.html" title="What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account?" class="phphistorical_Version2_mids_title">What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account?</a> <span class="Articlelist_txts_time">Mar 21, 2024 pm 04:16 PM</span> <p class="Articlelist_txts_p">As Xiaohongshu becomes popular among young people, more and more people are beginning to use this platform to share various aspects of their experiences and life insights. How to effectively manage multiple Xiaohongshu accounts has become a key issue. In this article, we will discuss some of the features of Xiaohongshu account management software and explore how to better manage your Xiaohongshu account. As social media grows, many people find themselves needing to manage multiple social accounts. This is also a challenge for Xiaohongshu users. Some Xiaohongshu account management software can help users manage multiple accounts more easily, including automatic content publishing, scheduled publishing, data analysis and other functions. Through these tools, users can manage their accounts more efficiently and increase their account exposure and attention. In addition, Xiaohongshu account management software has</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/faq/721257.html" title="How to implement the WeChat clone function on Huawei mobile phones" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/465/014/171127458764540.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How to implement the WeChat clone function on Huawei mobile phones" /> </a> <a href="https://www.php.cn/faq/721257.html" title="How to implement the WeChat clone function on Huawei mobile phones" class="phphistorical_Version2_mids_title">How to implement the WeChat clone function on Huawei mobile phones</a> <span class="Articlelist_txts_time">Mar 24, 2024 pm 06:03 PM</span> <p class="Articlelist_txts_p">How to implement the WeChat clone function on Huawei mobile phones With the popularity of social software and people's increasing emphasis on privacy and security, the WeChat clone function has gradually become the focus of people's attention. The WeChat clone function can help users log in to multiple WeChat accounts on the same mobile phone at the same time, making it easier to manage and use. It is not difficult to implement the WeChat clone function on Huawei mobile phones. You only need to follow the following steps. Step 1: Make sure that the mobile phone system version and WeChat version meet the requirements. First, make sure that your Huawei mobile phone system version has been updated to the latest version, as well as the WeChat App.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/faq/1796497519.html" title="Tsinghua University and Zhipu AI open source GLM-4: launching a new revolution in natural language processing" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/887/227/171819588762154.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="Tsinghua University and Zhipu AI open source GLM-4: launching a new revolution in natural language processing" /> </a> <a href="https://www.php.cn/faq/1796497519.html" title="Tsinghua University and Zhipu AI open source GLM-4: launching a new revolution in natural language processing" class="phphistorical_Version2_mids_title">Tsinghua University and Zhipu AI open source GLM-4: launching a new revolution in natural language processing</a> <span class="Articlelist_txts_time">Jun 12, 2024 pm 08:38 PM</span> <p class="Articlelist_txts_p">Since the launch of ChatGLM-6B on March 14, 2023, the GLM series models have received widespread attention and recognition. Especially after ChatGLM3-6B was open sourced, developers are full of expectations for the fourth-generation model launched by Zhipu AI. This expectation has finally been fully satisfied with the release of GLM-4-9B. The birth of GLM-4-9B In order to give small models (10B and below) more powerful capabilities, the GLM technical team launched this new fourth-generation GLM series open source model: GLM-4-9B after nearly half a year of exploration. This model greatly compresses the model size while ensuring accuracy, and has faster inference speed and higher efficiency. The GLM technical team’s exploration has not</p> </div> </div> <a href="https://www.php.cn/be/" class="phpgenera_Details_mainL4_botton"> <span>See all articles</span> <img src="/static/imghw/down_right.png" alt="" /> </a> </div> </div> </div> </main> <footer> <div class="footer"> <div class="footertop"> <img src="/static/imghw/logo.png" alt=""> <p>Public welfare online PHP training,Help PHP learners grow quickly!</p> </div> <div class="footermid"> <a href="https://www.php.cn/about/us.html">About us</a> <a href="https://www.php.cn/about/disclaimer.html">Disclaimer</a> <a href="https://www.php.cn/update/article_0_1.html">Sitemap</a> </div> <div class="footerbottom"> <p> © php.cn All rights reserved </p> </div> </div> </footer> <input type="hidden" id="verifycode" value="/captcha.html"> <script>layui.use(['element', 'carousel'], function () {var element = layui.element;$ = layui.jquery;var carousel = layui.carousel;carousel.render({elem: '#test1', width: '100%', height: '330px', arrow: 'always'});$.getScript('/static/js/jquery.lazyload.min.js', function () {$("img").lazyload({placeholder: "/static/images/load.jpg", effect: "fadeIn", threshold: 200, skip_invisible: false});});});</script> <script src="/static/js/common_new.js"></script> <script type="text/javascript" src="/static/js/jquery.cookie.js?1747088690"></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?2' 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 type="text/javascript" src="/static/js/global.min.js?5.5.53"></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> // top layui.use(function () { var util = layui.util; util.fixbar({ on: { mouseenter: function (type) { layer.tips(type, this, { tips: 4, fixed: true, }); }, mouseleave: function (type) { layer.closeAll("tips"); }, }, }); }); document.addEventListener("DOMContentLoaded", (event) => { // 定义一个函数来处理滚动链接的点击事件 function setupScrollLink(scrollLinkId, targetElementId) { const scrollLink = document.getElementById(scrollLinkId); const targetElement = document.getElementById(targetElementId); if (scrollLink && targetElement) { scrollLink.addEventListener("click", (e) => { e.preventDefault(); // 阻止默认链接行为 targetElement.scrollIntoView({ behavior: "smooth" }); // 平滑滚动到目标元素 }); } else { console.warn( `Either scroll link with ID '${scrollLinkId}' or target element with ID '${targetElementId}' not found.` ); } } // 使用该函数设置多个滚动链接 setupScrollLink("Article_Details_main1L2s_1", "article_main_title1"); setupScrollLink("Article_Details_main1L2s_2", "article_main_title2"); setupScrollLink("Article_Details_main1L2s_3", "article_main_title3"); setupScrollLink("Article_Details_main1L2s_4", "article_main_title4"); setupScrollLink("Article_Details_main1L2s_5", "article_main_title5"); setupScrollLink("Article_Details_main1L2s_6", "article_main_title6"); // 可以继续添加更多的滚动链接设置 }); window.addEventListener("scroll", function () { var fixedElement = document.getElementById("Article_Details_main1Lmain"); var scrollTop = window.scrollY || document.documentElement.scrollTop; // 兼容不同浏览器 var clientHeight = window.innerHeight || document.documentElement.clientHeight; // 视口高度 var scrollHeight = document.documentElement.scrollHeight; // 页面总高度 // 计算距离底部的距离 var distanceToBottom = scrollHeight - scrollTop - clientHeight; // 当距离底部小于或等于300px时,取消固定定位 if (distanceToBottom <= 980) { fixedElement.classList.remove("Article_Details_main1Lmain"); fixedElement.classList.add("Article_Details_main1Lmain_relative"); } else { // 否则,保持固定定位 fixedElement.classList.remove("Article_Details_main1Lmain_relative"); fixedElement.classList.add("Article_Details_main1Lmain"); } }); </script> <script> document.addEventListener('DOMContentLoaded', function() { const mainNav = document.querySelector('.Article_Details_main1Lmain'); const header = document.querySelector('header'); if (mainNav) { window.addEventListener('scroll', function() { const scrollPosition = window.scrollY; if (scrollPosition > 84) { mainNav.classList.add('fixed'); } else { mainNav.classList.remove('fixed'); } }); } }); </script> </body> </html>