Heim Backend-Entwicklung PHP-Tutorial Problem mit der Gültigkeitsdauer der PHP-Sitzung

Problem mit der Gültigkeitsdauer der PHP-Sitzung

May 28, 2018 pm 03:39 PM
php session 有效期

Der Standard-Sitzungsgültigkeitszeitraum in PHP beträgt 1440 Sekunden (24 Minuten) [weiweiok Hinweis: Der Standardwert in PHP5 ist 180 Minuten], das heißt, wenn der Client länger als 24 Minuten nicht aktualisiert wird, Die aktuelle Sitzung läuft ab. Offensichtlich reicht das nicht aus.

Problem mit der Gültigkeitsdauer der PHP-Sitzung

Eine bekannte effektive Methode besteht darin, die gesamte Sitzungsverwaltungsarbeit zu übernehmen. Im Allgemeinen werden die Sitzungsinformationen in der Datenbank gespeichert. Auf diese Weise können alle abgelaufenen Sitzungen durch SQL-Anweisungen gelöscht werden Die Sitzung kann genau gesteuert werden. Dies ist auch eine häufig verwendete Methode für große Websites, die auf PHP basieren. Für gewöhnliche kleine Websites scheint es jedoch nicht nötig zu sein, so hart zu arbeiten. session_set_save_handlerAber die allgemeine Sitzung hat eine begrenzte Lebensdauer. Wenn der Benutzer den Browser schließt, können die Sitzungsvariablen nicht gespeichert werden! Wie können wir also die dauerhafte Lebensdauer von Session erreichen?
Wie wir alle wissen, wird die Sitzung auf der Serverseite gespeichert, basierend auf der vom Client bereitgestellten Sitzungs-ID, und
liest dann die Datei, um den Wert der Variablen zu erhalten. Die SessionID kann das Cookie des Clients oder den Query_String des Http1-Protokolls (d. h. den Teil nach dem „?“ der aufgerufenen URL) an den Server übertragen, und dann liest der Server das Verzeichnis der Sitzung...
Um die dauerhafte Lebensdauer der Sitzung zu realisieren, müssen Sie zunächst die PHP-INI-Einstellungen im Zusammenhang mit der Sitzung verstehen (öffnen Sie die php.ini-Datei im Abschnitt „[Sitzung]“): 1 . session.use_cookies: Der Standardwert ist „1“, was bedeutet, dass SessionID zum Übergeben verwendet wird.
2: Dies ist der in SessionID gespeicherte Variablenname Zu übergebender Cookie oder Query_String:
3: Dies stellt die Zeit dar, zu der die SessionID im Client-Cookie gespeichert wird sobald der Browser geschlossen wird... Aus diesem Grund kann die Sitzung nicht dauerhaft genutzt werden!
4. session.gc_maxlifetime: Dies ist die Zeit, die Sitzungsdaten auf der Serverseite gespeichert werden. Wenn diese Zeit überschritten wird, werden die Sitzungsdaten automatisch gelöscht!
Es gibt noch viele weitere Einstellungen, aber diese beziehen sich auf diesen Artikel. Beginnen wir mit den Prinzipien und Schritten der Verwendung einer permanenten Sitzung.
Wie bereits erwähnt, liest der Server Sitzungsdaten über SessionID, aber im Allgemeinen ist die vom Browser gesendete SessionID nach dem Schließen des Browsers verschwunden, sodass wir die SessionID nur manuell festlegen und speichern müssen, nein ...

Wenn Sie über die Betriebsberechtigungen des Servers verfügen, ist die Einstellung sehr, sehr einfach. Sie müssen lediglich die folgenden Schritte ausführen: 1. Setzen Sie „session.use_cookies“ auf 1 und aktivieren Sie es Cookie-Speicherung. SessionID, aber der Standardwert ist 1, muss im Allgemeinen nicht geändert werden; 999999999 und positiv unendlich);
3. Ändern Sie „session.gc_maxlifetime“ auf die gleiche Zeit wie „session.cookie_lifetime“; ist session.gc_maxlifetime. Dieser Parameter kann in der Datei php.ini oder über die Funktion ini_set() geändert werden. Das Problem besteht darin, dass die Änderung dieses Parameters nach vielen Tests grundsätzlich keine Auswirkung hat und die Sitzungsgültigkeitsdauer immer noch den Standardwert von 24 Minuten beibehält.
Aufgrund des Arbeitsmechanismus von PHP verfügt es nicht über einen Daemon-Thread, um Sitzungsinformationen regelmäßig zu scannen und festzustellen, ob sie ungültig sind. Wenn eine gültige Anfrage auftritt, entscheidet PHP basierend auf dem Wert der globalen Variablen session.gc_probability/session.gc_pisor (der auch über die Funktion php.ini oder ini_set() geändert werden kann) ob ein GC (Garbage Collector) gestartet wird. . Standardmäßig ist session.gc_probability = 1, session.gc_pisor = 100, was bedeutet, dass die Wahrscheinlichkeit, dass GC gestartet wird, bei 1 % liegt. Die Aufgabe von

besteht darin, alle Sitzungsinformationen zu scannen, die letzte Änderungszeit (Änderungsdatum) der Sitzung von der aktuellen Zeit zu subtrahieren und sie mit dem Parameter session.gc_maxlifetime zu vergleichen, wenn die Überlebenszeit gc_maxlifetime überschritten hat , Ersetzen Sie die Sitzung durch Löschen.

Bisher funktioniert alles gut. Warum wird gc_maxlifetime ungültig? GC
Standardmäßig werden Sitzungsinformationen in Form von Textdateien im temporären Dateiverzeichnis des Systems gespeichert. Unter Linux ist dieser Pfad normalerweise tmp und unter Windows normalerweise . Wenn mehrere PHP-Anwendungen auf dem Server vorhanden sind, speichern diese ihre Sitzungsdateien im selben Verzeichnis. Ebenso starten diese PHP-Anwendungen mit einer bestimmten Wahrscheinlichkeit auch GC und scannen alle Sitzungsdateien. Das Problem besteht darin, dass GC, wenn es funktioniert, nicht zwischen Sitzungen auf verschiedenen Sites unterscheidet. Beispielsweise ist
von Site A auf 2 Stunden und gc_maxlifetime von Site B auf den Standardwert 24 Minuten eingestellt. Wenn der GC von Site B startet, scannt er das öffentliche temporäre Dateiverzeichnis und löscht alle Sitzungsdateien, die älter als 24 Minuten sind, unabhängig davon, ob sie von Site A oder B stammen. Auf diese Weise sind die C:WindowsTemp-Einstellungen von Site A nutzlos.
Sobald Sie das Problem gefunden haben, ist es einfach, es zu lösen. Ändern Sie den Parameter gc_maxlifetime oder verwenden Sie die Funktion gc_maxlifetime, um das Verzeichnis, in dem die Sitzung gespeichert ist, auf ein dediziertes Verzeichnis zu verweisen. Der Parameter
funktioniert normal. session.save_pathsession_save_path()Ist das streng genommen ein Fehler in PHP? gc_maxlifetime
Ein weiteres Problem besteht darin, dass gc_maxlifetime nur die kürzeste Überlebenszeit der Sitzung garantieren kann und nicht gespeichert werden kann. Nach dieser Zeit werden die Sitzungsinformationen sofort gelöscht. Da GC auf Wahrscheinlichkeitsbasis gestartet wird und möglicherweise über einen längeren Zeitraum nicht gestartet wird, ist eine große Anzahl von Sitzungen nach Überschreiten von gc_maxlifetime weiterhin gültig. Eine Möglichkeit, dieses Problem zu lösen, besteht darin, die Wahrscheinlichkeit von session.gc_probability/session.gc_pisor zu erhöhen. Wenn es auf 100 % erwähnt wird, wird dieses Problem vollständig gelöst, aber es wird offensichtlich schwerwiegende Auswirkungen auf die Leistung haben. Eine andere Methode besteht darin, die Lebensdauer der aktuellen Sitzung in Ihrem Code zu bestimmen. Wenn sie gc_maxlifetime überschreitet, löschen Sie die aktuelle Sitzung.
Wenn Sie jedoch nicht über die Berechtigung zum Betreiben des Servers verfügen, ist dies problematischer. Sie müssen die SessionID über das PHP-Programm neu schreiben, um eine dauerhafte Speicherung der Sitzungsdaten zu erreichen. Schauen Sie im Funktionshandbuch von php.net nach und Sie können die Funktion „session_id“ sehen: Wenn keine Parameter gesetzt sind, wird die aktuelle SessionID zurückgegeben. Wenn die Parameter gesetzt sind, wird die aktuelle SessionID auf den angegebenen Wert gesetzt...
Solange Sie ein permanentes Cookie verwenden und die Funktion „session_id“ hinzufügen, können Sie permanente Sitzungsdaten speichern!
Aber der Einfachheit halber müssen wir den vom Server festgelegten „session.name“ kennen, aber die meisten Benutzer haben keine Berechtigung, die php.ini-Einstellungen des Servers anzuzeigen. PHP bietet jedoch eine sehr gute Funktion „phpinfo“. ", mit dem fast alle PHP-Informationen angezeigt werden können!
--------------------------------- --- -------------------------------------
PHP-bezogene Informationen display< /title> -------------------------------------------------- -- -- <br>Öffnen Sie den Editor, geben Sie den obigen Code ein und führen Sie dann das Programm im Browser aus. Sie sehen PHP-bezogene Informationen (wie in Abbildung 1 dargestellt). Es gibt einen Parameter „session.name“, bei dem es sich um den Server „session.name“ handelt, den wir benötigen, normalerweise „phpsessid“. <br>Nachdem wir den Namen der SessionID notiert haben, können wir eine dauerhafte Speicherung der Sitzungsdaten erreichen! <br><br><br>Der Code lautet wie folgt:</p> <p class="codetitle"></p>Postscript: <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class='brush:php;toolbar:false;'>session_start(); ini_set(&#39;session.save_path&#39;,&#39;/tmp/&#39;); //6个钟头 ini_set(&#39;session.gc_maxlifetime&#39;,21600); //保存一天 $lifeTime = 24 * 3600; setcookie(session_name(), session_id(), time() + $lifeTime, "/");</pre><div class="contentsignin">Nach dem Login kopieren</div></div>Tatsächlich ist eine echte dauerhafte Speicherung unmöglich, da die Speicherzeit von Cookies begrenzt ist und der Speicherplatz begrenzt ist des Servers ist ebenfalls begrenzt... …Aber für einige Websites, die über einen längeren Zeitraum gespeichert werden müssen, reicht die obige Methode aus! <p>Fügen Sie die Sitzung in MySQL ein. Beispiel: <br/>Erstellen Sie eine Tabelle in der Datenbank: session (sesskey varchar32, expiry int11, value longtext) <br/>Code: <br/>Die Datenbank wurde <br/>vor der Ausführung von verbunden der Code<br/> . <a href="http://www.php.cn/wiki/409.html" target="_blank"></a><br/>Der Code lautet wie folgt:</p><p class="codetitle"></p>Ich verstehe immer noch nicht, woher die Öffnungs- und Schreibparameter kommen. Zwei häufig verwendete Funktionen zum Ändern der php.ini-Konfiguration: get_cfg_var('session.gc_maxlifetime'): Ruft den Wert von session.gc_maxlifetime ab ini_set('session.cookie_lifetime','0'): Setzt den Wert von session.cookie_lifetime auf 0. <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class='brush:php;toolbar:false;'>define(&#39;STORE_SESSIONS&#39;,&#39;mysql&#39;); if (STORE_SESSIONS == &#39;mysql&#39;) { if (!$SESS_LIFE = get_cfg_var(&#39;session.gc_maxlifetime&#39;)) { $SESS_LIFE = 1440; } function _sess_open($save_path, $session_name) { // 如果没有连接数据库,可以在此执行mysql_pconnect,mysql_select_db return true; } function _sess_close() { return true; } function _sess_read($key) { $value_query = mysql_query("select value from sessions where sesskey = &#39;" .addslashes($key) . "&#39; and expiry > &#39;" . time() . "&#39;"); $value = mysql_fetch_array($value_query); if (isset($value[&#39;value&#39;])) { return $value[&#39;value&#39;]; } return false; } function _sess_write($key, $val) { global $SESS_LIFE; $expiry = time() + $SESS_LIFE; $value = $val; $check_query = mysql_query("select count(*) as total from sessions where sesskey = &#39;" . addslashes($key) . "&#39;"); $check = mysql_fetch_array($check_query); if ($check[&#39;total&#39;] > 0) { return mysql_query("update sessions set expiry = &#39;" . addslashes($expiry) . "&#39;, value = &#39;" . addslashes($value) . "&#39; where sesskey = &#39;" . addslashes($key) . "&#39;"); } else { return mysql_query("insert into sessions values (&#39;" . addslashes($key) . "&#39;, &#39;" . addslashes($expiry) . "&#39;, &#39;" . addslashes($value) . "&#39;)"); } } function _sess_destroy($key) { return mysql_query("delete from sessions where sesskey = &#39;" . addslashes($key) . "&#39;"); } function _sess_gc($maxlifetime) { mysql_query("delete from sessions where expiry < &#39;" . time() . "&#39;"); return true; } session_set_save_handler(&#39;_sess_open&#39;, &#39;_sess_close&#39;, &#39;_sess_read&#39;, &#39;_sess_write&#39;, &#39;_sess_destroy&#39;, &#39;_sess_gc&#39;); } danoo_session_name( &#39;dtvSid&#39; ); danoo_session_save_path(SESSION_WRITE_DIRECTORY);</pre><div class="contentsignin">Nach dem Login kopieren</div></div><p></p> <blockquote>Empfehlungen zu verwandten Themen<p>: <span style="color: rgb(255, 0, 0);">PHP-Sitzung</span> (einschließlich Bilder, Videos, Fälle) <a href="https://www.php.cn/php-weizijiaocheng-454911.html" target="_blank"></a></p> </blockquote><p>Das obige ist der detaillierte Inhalt vonProblem mit der Gültigkeitsdauer der PHP-Sitzung. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!</p> </div> </div> <div class="wzconShengming_sp"> <div class="bzsmdiv_sp">Erklärung dieser Website</div> <div>Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an 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>Heißer Artikel</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/1796780570.html" title="R.E.P.O. Energiekristalle erklärten und was sie tun (gelber Kristall)" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O. Energiekristalle erklärten und was sie tun (gelber Kristall)</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 Wochen vor</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/1796780641.html" title="R.E.P.O. Beste grafische Einstellungen" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O. Beste grafische Einstellungen</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 Wochen vor</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/1796785841.html" title="Assassin's Creed Shadows: Seashell Riddle -Lösung" class="phpgenera_Details_mainR4_bottom_title">Assassin's Creed Shadows: Seashell Riddle -Lösung</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>2 Wochen vor</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/1796780520.html" title="R.E.P.O. So reparieren Sie Audio, wenn Sie niemanden hören können" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O. So reparieren Sie Audio, wenn Sie niemanden hören können</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 Wochen vor</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/1796779766.html" title="WWE 2K25: Wie man alles in Myrise freischaltet" class="phpgenera_Details_mainR4_bottom_title">WWE 2K25: Wie man alles in Myrise freischaltet</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 Wochen vor</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/de/article.html">Mehr anzeigen</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>Heiße KI -Werkzeuge</h2> </div> <div class="phpgenera_Details_mainR3_bottom"> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/de/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/de/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_title"> <h3>Undresser.AI Undress</h3> </a> <p>KI-gestützte App zum Erstellen realistischer Aktfotos</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/de/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/de/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_title"> <h3>AI Clothes Remover</h3> </a> <p>Online-KI-Tool zum Entfernen von Kleidung aus Fotos.</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/de/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/de/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_title"> <h3>Undress AI Tool</h3> </a> <p>Ausziehbilder kostenlos</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/de/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/de/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_title"> <h3>Clothoff.io</h3> </a> <p>KI-Kleiderentferner</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/de/ai/ai-hentai-generator" title="AI Hentai Generator" 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/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://www.php.cn/de/ai/ai-hentai-generator" title="AI Hentai Generator" class="phpmain_tab2_mids_title"> <h3>AI Hentai Generator</h3> </a> <p>Erstellen Sie kostenlos Ai Hentai.</p> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/de/ai">Mehr anzeigen</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>Heißer Artikel</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/1796780570.html" title="R.E.P.O. Energiekristalle erklärten und was sie tun (gelber Kristall)" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O. Energiekristalle erklärten und was sie tun (gelber Kristall)</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 Wochen vor</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/1796780641.html" title="R.E.P.O. Beste grafische Einstellungen" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O. Beste grafische Einstellungen</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 Wochen vor</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/1796785841.html" title="Assassin's Creed Shadows: Seashell Riddle -Lösung" class="phpgenera_Details_mainR4_bottom_title">Assassin's Creed Shadows: Seashell Riddle -Lösung</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>2 Wochen vor</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/1796780520.html" title="R.E.P.O. So reparieren Sie Audio, wenn Sie niemanden hören können" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O. So reparieren Sie Audio, wenn Sie niemanden hören können</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 Wochen vor</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/1796779766.html" title="WWE 2K25: Wie man alles in Myrise freischaltet" class="phpgenera_Details_mainR4_bottom_title">WWE 2K25: Wie man alles in Myrise freischaltet</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 Wochen vor</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/de/article.html">Mehr anzeigen</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>Heiße Werkzeuge</h2> </div> <div class="phpgenera_Details_mainR3_bottom"> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/de/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/de/toolset/development-tools/92" title="Notepad++7.3.1" class="phpmain_tab2_mids_title"> <h3>Notepad++7.3.1</h3> </a> <p>Einfach zu bedienender und kostenloser Code-Editor</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/de/toolset/development-tools/93" title="SublimeText3 chinesische 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 chinesische Version" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/de/toolset/development-tools/93" title="SublimeText3 chinesische Version" class="phpmain_tab2_mids_title"> <h3>SublimeText3 chinesische Version</h3> </a> <p>Chinesische Version, sehr einfach zu bedienen</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/de/toolset/development-tools/121" title="Senden Sie 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="Senden Sie Studio 13.0.1" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/de/toolset/development-tools/121" title="Senden Sie Studio 13.0.1" class="phpmain_tab2_mids_title"> <h3>Senden Sie Studio 13.0.1</h3> </a> <p>Leistungsstarke integrierte PHP-Entwicklungsumgebung</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/de/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/de/toolset/development-tools/469" title="Dreamweaver CS6" class="phpmain_tab2_mids_title"> <h3>Dreamweaver CS6</h3> </a> <p>Visuelle Webentwicklungstools</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/de/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/de/toolset/development-tools/500" title="SublimeText3 Mac-Version" class="phpmain_tab2_mids_title"> <h3>SublimeText3 Mac-Version</h3> </a> <p>Codebearbeitungssoftware auf Gottesniveau (SublimeText3)</p> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/de/ai">Mehr anzeigen</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>Heiße Themen</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/gmailyxdlrkzn" title="Wo ist der Login-Zugang für Gmail-E-Mail?" class="phpgenera_Details_mainR4_bottom_title">Wo ist der Login-Zugang für Gmail-E-Mail?</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>7465</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>15</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/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>1376</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/de/faq/steamdzhmcssmgs" title="Wie lautet das Format des Kontonamens von Steam?" class="phpgenera_Details_mainR4_bottom_title">Wie lautet das Format des Kontonamens von Steam?</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>77</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>11</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/winactivationkeyper" title="Win11 -Aktivierungsschlüssel dauerhaft" class="phpgenera_Details_mainR4_bottom_title">Win11 -Aktivierungsschlüssel dauerhaft</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>45</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>19</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/de/faq/newyorktimesdailybrief" title="NYT -Verbindungen Hinweise und Antworten" class="phpgenera_Details_mainR4_bottom_title">NYT -Verbindungen Hinweise und Antworten</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>18</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>19</span> </div> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/de/faq/zt">Mehr anzeigen</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/de/faq/1796733273.html" title="PHP 8.4 Installations- und Upgrade-Anleitung für Ubuntu und Debian" 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/080/676a727698393240.png?x-oss-process=image/resize,m_fill,h_207,w_330" alt="PHP 8.4 Installations- und Upgrade-Anleitung für Ubuntu und Debian" /> </a> <a href="https://www.php.cn/de/faq/1796733273.html" title="PHP 8.4 Installations- und Upgrade-Anleitung für Ubuntu und Debian" class="phphistorical_Version2_mids_title">PHP 8.4 Installations- und Upgrade-Anleitung für Ubuntu und Debian</a> <span class="Articlelist_txts_time">Dec 24, 2024 pm 04:42 PM</span> <p class="Articlelist_txts_p">PHP 8.4 bringt mehrere neue Funktionen, Sicherheitsverbesserungen und Leistungsverbesserungen mit einer beträchtlichen Menge an veralteten und entfernten Funktionen. In dieser Anleitung wird erklärt, wie Sie PHP 8.4 installieren oder auf PHP 8.4 auf Ubuntu, Debian oder deren Derivaten aktualisieren. Obwohl es möglich ist, PHP aus dem Quellcode zu kompilieren, ist die Installation aus einem APT-Repository wie unten erläutert oft schneller und sicherer, da diese Repositorys in Zukunft die neuesten Fehlerbehebungen und Sicherheitsupdates bereitstellen.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/de/faq/1796604983.html" title="CakePHP arbeitet mit Datenbank" 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/172596033673647.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="CakePHP arbeitet mit Datenbank" /> </a> <a href="https://www.php.cn/de/faq/1796604983.html" title="CakePHP arbeitet mit Datenbank" class="phphistorical_Version2_mids_title">CakePHP arbeitet mit Datenbank</a> <span class="Articlelist_txts_time">Sep 10, 2024 pm 05:25 PM</span> <p class="Articlelist_txts_p">Das Arbeiten mit der Datenbank in CakePHP ist sehr einfach. In diesem Kapitel werden wir die CRUD-Operationen (Erstellen, Lesen, Aktualisieren, Löschen) verstehen.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/de/faq/1796604998.html" title="CakePHP Datum und Uhrzeit" 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/172596042710877.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="CakePHP Datum und Uhrzeit" /> </a> <a href="https://www.php.cn/de/faq/1796604998.html" title="CakePHP Datum und Uhrzeit" class="phphistorical_Version2_mids_title">CakePHP Datum und Uhrzeit</a> <span class="Articlelist_txts_time">Sep 10, 2024 pm 05:27 PM</span> <p class="Articlelist_txts_p">Um in cakephp4 mit Datum und Uhrzeit zu arbeiten, verwenden wir die verfügbare FrozenTime-Klasse.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/de/faq/1796604999.html" title="CakePHP-Datei hochladen" 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/172596043255110.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="CakePHP-Datei hochladen" /> </a> <a href="https://www.php.cn/de/faq/1796604999.html" title="CakePHP-Datei hochladen" class="phphistorical_Version2_mids_title">CakePHP-Datei hochladen</a> <span class="Articlelist_txts_time">Sep 10, 2024 pm 05:27 PM</span> <p class="Articlelist_txts_p">Um am Datei-Upload zu arbeiten, verwenden wir den Formular-Helfer. Hier ist ein Beispiel für den Datei-Upload.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/de/faq/1796605002.html" title="Besprechen Sie CakePHP" 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/202409/10/2024091017281739989.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="Besprechen Sie CakePHP" /> </a> <a href="https://www.php.cn/de/faq/1796605002.html" title="Besprechen Sie CakePHP" class="phphistorical_Version2_mids_title">Besprechen Sie CakePHP</a> <span class="Articlelist_txts_time">Sep 10, 2024 pm 05:28 PM</span> <p class="Articlelist_txts_p">CakePHP ist ein Open-Source-Framework für PHP. Es soll die Entwicklung, Bereitstellung und Wartung von Anwendungen erheblich vereinfachen. CakePHP basiert auf einer MVC-ähnlichen Architektur, die sowohl leistungsstark als auch leicht zu verstehen ist. Modelle, Ansichten und Controller gu</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/de/faq/1796604997.html" title="CakePHP erstellt Validatoren" 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/172596041825531.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="CakePHP erstellt Validatoren" /> </a> <a href="https://www.php.cn/de/faq/1796604997.html" title="CakePHP erstellt Validatoren" class="phphistorical_Version2_mids_title">CakePHP erstellt Validatoren</a> <span class="Articlelist_txts_time">Sep 10, 2024 pm 05:26 PM</span> <p class="Articlelist_txts_p">Der Validator kann durch Hinzufügen der folgenden zwei Zeilen im Controller erstellt werden.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/de/faq/1796604990.html" title="CakePHP-Protokollierung" 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/172596037751490.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="CakePHP-Protokollierung" /> </a> <a href="https://www.php.cn/de/faq/1796604990.html" title="CakePHP-Protokollierung" class="phphistorical_Version2_mids_title">CakePHP-Protokollierung</a> <span class="Articlelist_txts_time">Sep 10, 2024 pm 05:26 PM</span> <p class="Articlelist_txts_p">Die Anmeldung bei CakePHP ist eine sehr einfache Aufgabe. Sie müssen nur eine Funktion verwenden. Sie können Fehler, Ausnahmen, Benutzeraktivitäten und von Benutzern durchgeführte Aktionen für jeden Hintergrundprozess wie Cronjob protokollieren. Das Protokollieren von Daten in CakePHP ist einfach. Die Funktion log() wird bereitgestellt</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/de/faq/1796728164.html" title="So richten Sie Visual Studio-Code (VS-Code) für die PHP-Entwicklung ein" 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/080/6764e39e44ffe544.png?x-oss-process=image/resize,m_fill,h_207,w_330" alt="So richten Sie Visual Studio-Code (VS-Code) für die PHP-Entwicklung ein" /> </a> <a href="https://www.php.cn/de/faq/1796728164.html" title="So richten Sie Visual Studio-Code (VS-Code) für die PHP-Entwicklung ein" class="phphistorical_Version2_mids_title">So richten Sie Visual Studio-Code (VS-Code) für die PHP-Entwicklung ein</a> <span class="Articlelist_txts_time">Dec 20, 2024 am 11:31 AM</span> <p class="Articlelist_txts_p">Visual Studio Code, auch bekannt als VS Code, ist ein kostenloser Quellcode-Editor – oder eine integrierte Entwicklungsumgebung (IDE) –, die für alle gängigen Betriebssysteme verfügbar ist. Mit einer großen Sammlung von Erweiterungen für viele Programmiersprachen kann VS Code c</p> </div> </div> <a href="https://www.php.cn/de/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>Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!</p> </div> <div class="footermid"> <a href="https://www.php.cn/de/about/us.html">Über uns</a> <a href="https://www.php.cn/de/about/disclaimer.html">Haftungsausschluss</a> <a href="https://www.php.cn/de/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?1744381468"></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> </body> </html>