ホームページ バックエンド開発 PHPチュートリアル 実践的な php mysql データベース接続 class_PHP チュートリアル

実践的な php mysql データベース接続 class_PHP チュートリアル

Jul 13, 2016 pm 05:09 PM
mysql php 負荷 チュートリアル データベース 使用 親切 自動 接続する

phpチュートリアルmysqlチュートリアルデータベースチュートリアル接続クラス
このデータベース接続クラスは、SQL アンチインジェクション関数を自動的にロードし、いくつかの機密性の高い SQL クエリ キーワードをフィルタリングします。また、データベース内のすべてのテーブル名を取得するためのテーブル ステータスの表示やテーブル クラスの表示などの判断フィールドを追加することもできます。 。 */
@ini_set('mysql.trace_mode','off');
クラスmysql
{
パブリック $dblink;
パブリック $pconnect;
private $search = array('/union(s*(/*.**/)?s*)+select/i', '/load_file(s*(/*.**/)?s*)+( /i', '/into(s*(/*.**/)?s*)+outfile/i');
private $replace = array('union   select', 'load_file   (', 'into   outfile');
プライベート $rs;

関数 __construct($hostname,$username,$userpwd,$database,$pconnect=false,$charset='utf8')
{
define('allowed_htmltags', '<meta><body><a><p><br><hr><h1><h2> ;<h3><h4><h5><h6><font>gt;<u><i><b><strong><div><span><ol>< ;ul><li><img alt="実践的な php mysql データベース接続 class_PHP チュートリアル" ><テーブル><tr><td><マップ>'); $this->pconnect=$pconnect;<br /> $this->dblink=$pconnect?mysql_pconnect($hostname,$username,$userpwd):mysql_connect($hostname,$username,$userpwd);<br /> (!$this->dblink||!is_resource($this->dblink)) && Fatal_error("データベースへの接続に失敗しました!");<br> @mysql_unbuffered_query("セット名 {$charset}");<br> if($this->version()>'5.0.1')<br> {<br> @mysql_unbuffered_query("set sql_mode = ''");<br> }<br> @mysql_select_db($database) または Fatal_error("テーブルを選択できません!");<br> $this->dblink;<br> を返す }<br> </p>関数クエリ($sql,$unbuffered=false)<p> {<br> // $sql をエコーし​​ます。'<br>';<br> $this->rs=$unbuffered?mysql_unbuffered_query($sql,$this->dblink):mysql_query($sql,$this->dblink);<br> //(!$this->rs||!is_resource($this->rs)) && Fatal_error("クエリの実行に失敗しました! error:".mysql_error());<br> if(!$this->rs)fatal_error('SQL ステートメント '.$sql.' の実行時に次のエラーが発生しました:'.mysql_error());<br> $this->rs; を返す<br> }<br> </p>関数 fetch_one($sql)<p> {<br> $this->rs=$this->クエリ($sql);<br> dircms_strips チュートリアルを返す lashes($this->filter_pass(mysql_fetch_array($this->rs,mysql_assoc)));<br> }<br> </p> function get_maxfield($filed='id',$table) // $table テーブルの $filed フィールドの最大値を取得します<p> {<br> $r=$this->fetch_one("select {$table}.{$filed} from `{$table}` order by `{$table}`.`{$filed}` desc limit 0,1") ;<br> $r[$filed] を返します;<br> }<br> </p>関数 fetch_all($sql)<p> {<br> $this->rs=$this->クエリ($sql);<br> $result=array();<br> while($rows=mysql_fetch_array($this->rs,mysql_assoc))<br> {<br> $result[]=$rows;<br> }<br> <br> mysql_free_result($this->rs);<br> dircms_stripslashes($this->filter_pass($result)) を返します <br> }<br> </p>関数 fetch_all_withkey($sql,$key='id')<p> {<br> $this->rs=$this->クエリ($sql);<br> $result=array();<br> while($rows=mysql_fetch_array($this->rs,mysql_assoc))<br> {<br> $result[$rows[$key]]=$rows;<br> }<br> <br> mysql_free_result($this->rs);<br> dircms_stripslashes($this->filter_pass($result)) を返します <br> }<br> </p>関数 last_insert_id()<p> {<br> if(($insertid=mysql_insert_id($this->dblink))>0)return $insertid;<br> else //auto_increment のカラム型が bigint の場合、mysql_insert_id() によって返される値は正しくありません。<br> {<br> $result=$this->fetch_one('last_insert_id() を insertid として選択');<br> $result['insertid'];<br>を返します }<br> }<br></p> <p> 関数挿入($tbname,$varray,$replace=false)<br>  {<br>   $varray=$this->escape($varray);<br>   $tb_fields=$this->get_fields($tbname); // mb.bKjia.c0m 升级一下,增加判断字段有無<br>   <br>   foreach($varray as $key => $value)<br>   {<br>    if(in_array($key,$tb_fields))<br>    {<br>     $filds[]='`'.$key.'`';<br>     $values[]=is_string($value)?'''.$value.''':$value;<br>    }<br>   }</p> <p> if($fileds)<br>   {<br>    $filds=implode(',',$fileds);<br>    $filds=str_replace(''','`',$fileds);<br>    $values=implode(',',$values);<br>    $sql=$replace?"{$tbname}({$fileds}) の値 ({$values}) に置き換えます":"{$tbname}({$fileds}) の値 ({$values}) に挿入します"; <br>    $this->query($sql,true);<br>    return $this->last_insert_id();<br>   }<br>   それ以外の場合は false を返します;<br>  }</p> <p> 関数更新($tbname, $array, $where = '')<br>  {<br>   $array=$this->escape($array);<br>   if($where)<br>   {<br>    $tb_fields=$this->get_fields($tbname); // www.bKjia.c0m,增加判断字段有無<br>    <br>    $sql = '';<br>    foreach($array as $k=>$v)<br>    {<br>     if(in_array($k,$tb_fields))<br>     {<br>      $k=str_replace('','',$k);<br>      $sql .= ", `$k`='$v'";<br>     }<br>    }<br>    $sql = substr($sql, 1);<br>    <br>    if($sql)$sql = "更新 `$tbname` set $sql where $where";<br>    それ以外の場合は true を返します;<br>   }<br>   それ以外<br>   {<br>    $sql = "`$tbname`(`".implode('`,`', array_keys($array))."`) 値('".implode("','", $array) に置き換えます。" ')";<br>   }<br>   return $this->query($sql,true);<br>  }<br>  <br>  function mysql_delete($tbname,$idarray,$filedname='id')<br>  {<br>   $idwhere=is_array($idarray)?implode(',',$idarray):intval($idarray);<br>   $where=is_array($idarray)?"{$tbname}.{$filedname} in ({$idwhere})":" {$tbname}.{$filedname}={$idwhere}";</p> <p> return $this->query("delete from {$tbname} where {$where}",true);<br>  }</p> <p> 関数 get_fields($table)<br>  {<br>   $fields=array();<br>   $result=$this->fetch_all("`{$table}` の列を表示");<br>   foreach($result as $val)<br>   {<br>    $fields[]=$val['フィールド'];<br>   }<br>   $fields を返します;<br>  }</p> <p> 関数 get_table_status($database)<br>  {<br>   $status=array();<br>   $r=$this->fetch_all("`".$database."`" からテーブルのステータスを表示); /////// show table ステータスの特性は show table と同様ですが、各テーブルの大量の情報を提供できます。   foreach($r as $v)<br>   {<br>    $status[]=$v;<br>   }<br>   $status を返します;<br>  }<br> </p> 関数 get_one_table_status($table)<p>  {<br>   return $this->fetch_one("'$table' のようなテーブルのステータスを表示");<br>  }<br> </p> function create_fields($tbname,$fieldname,$size=0,$type='varchar') // 2010-5-14 修正一下<p>  { <br>   if($size)<br>   {<br>    $size=strtoupper($type)=='varchar'?$size:8;<br>    $this->query("alter table `{$tbname}` add `$fieldname` {$type}( {$size} ) not null",true);<br>   }<br>   else $this->query("alter table `{$tbname}` add `$fieldname` mediatext not null",true);<br>   true を返します;<br>  }<br> </p> function get_tables() //すべての表表名を取得します<p>  {<br>   $tables=array();<br>   $r=$this->fetch_all("テーブルを表示");<br>   foreach($r as $v)<br>   {<br>    foreach($v として $v_)<br>    {<br>     $tables[]=$v_;<br>    }<br>   }<br>   $tables を返します;<br>  }<br></p> <p> function create_model_table($tbname) //コンテンツ モデル テーブルを作成します (開始: 最初はフィールド contentid int(20) のみ、コンテンツ テーブルに使用されます。 ////////////////// / //// 更新: 2010-5-20 `content` メディアテキストが null ではありません、フィールドはデフォルトで追加されました)<br> {<br> if(in_array($tbname,$this->get_tables())) return false; ///////////////////// テーブル名がすでに存在する場合、 falseを返します <br> if($this->query("テーブル `{$tbname}` を作成します (<br>) `contentid` mediaint(8) が null ではありません、<br> `content` メディアテキストが null ではありません、<br> キー(`コンテンツID`) <br> ) エンジン = myisam デフォルト charset=utf8",true))return true; ///////////////////// 成功時に true を返します<br> false を返す /////////////失敗した場合は false を返します<br> }</p> <p> function create_table($tbname) //メンバー モデルの空のテーブルを作成します (最初はフィールド userid int(20) のみ、メンバー テーブルに使用、2010-4-26)<br> {<br> if(in_array($tbname,$this->get_tables())) return false;<br> if($this->query("テーブル `{$tbname}` を作成します (<br>) `userid` mediaint(8) が null ではありません、<br> キー ( `userid` ) <br> ) エンジン = myisam デフォルト charset=utf8",true))true を返します;<br> false を返します;<br> }</p> <p> functionscape($str) // 危険な文字をフィルタリングします<br> {<br> if(!is_array($str)) return str_replace(array('n', 'r'), array(chr(10), chr(13)),mysql_real_escape_string(preg_replace($this->search,$this- >replace, $str), $this->dblink));<br> foreach($str as $key=>$val) $str[$key] = $this->escape($val);<br> $str;<br>を返します }</p> <p> function filter_pass($string, $allowedtags = '', $disabledattributes = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus'、'onbeforepaste'、'onbeforeprint'、'onbeforeunload'、'onbeforeupdate'、'onblur'、'onbounce'、'oncellchange'、'onchange'、'onclick'、'oncontextmenu'、'oncontrolselect'、'oncopy '、'oncut'、'ondataavaible'、'ondatasetchanged'、'ondatasetcomplete'、'ondblclick'、'ondeactivate'、'ondrag'、'ondragdrop'、'ondragend'、'ondragenter'、'ondragleave'、'ondragover'、 'ondragstart'、'ondrop'、'onerror'、'onerrorupdate'、'onfilterupdate'、'onfinish'、'onfocus'、'onfocusin'、'onfocusout'、'onhelp'、'onkeydown'、'onkeypress'、'onkeyup '、'onlayoutcomplete'、'onload'、'onlosecapture'、'onmousedown'、'onmouseenter'、'onmouseleave'、'onmousemove'、'onmoveout'、'onmouseotutorialver'、'onmouseup'、'onmousewheel'、'onmove ', 'onmoveend'、'onmovestart'、'onpaste'、'onpropertychange'、'onreadystatechange'、'onreset'、'onresize'、'onresizeend'、'onresizestart'、'onrowexit'、'onrowsdelete'、'onrowsinserted'、'onscroll '、'onselect'、'onselectionchange'、'onselectstart'、'onstart'、'onstop'、'onsubmit'、'onunload'))<br> {<br> if(is_array($string))<br> {<br> foreach($string as $key => $val) $string[$key] = $this->filter_pass($val, allowed_htmltags);<br> }<br> それ以外<br> {<br> $string = preg_replace('/s('.implode('|', $disabledattributes).').*?([s>])/', '2', preg_replace('/<(.*?) >/ie', "'<'.preg_replace(array('/Web ページの効果:[^"']*/i', '/(".implode('|', $disabledattributes).")[ tn ]*=[ tn]*["'][^"']*["']/i', '/s+/')、array('', '', ' ')、stripslashes('1' ) ) '>'"、strip_tags($string, $allowedtags)));<br> }<br> $string を返します;<br> }</p> <p>関数drop_table($tbname)<br> {<br> Return $this->query("存在する場合はテーブルを削除 `{$tbname}`",true);<br> }</p> <p>関数バージョン()<br> {<br> mysql_get_server_info($this->dblink)を返します;<br> }<br> }</p> <p align="left"></p> <div style="display:none;"> <span id="url" itemprop="url">http://www.bkjia.com/PHPjc/629738.html</span><span id="indexUrl" itemprop="indexUrl">www.bkjia.com</span><span id="isOriginal" itemprop="isOriginal">tru​​e</span><span id="isBasedOnUrl" itemprop="isBasedOnUrl">http://www.bkjia.com/PHPjc/629738.html</span><span id="genre" itemprop="genre">技術記事</span><span id="description" itemprop="description"> php チュートリアル mysql チュートリアル データベース チュートリアル 接続クラス このデータベース接続クラスは、SQL アンチインジェクション関数を自動的にロードし、いくつかの機密性の高い SQL クエリ キーワードをフィルタリングし、判断ワードも追加します...</span> </div> <div class="art_confoot"></div> </div> </div> <div class="wzconShengming_sp"> <div class="bzsmdiv_sp">このウェブサイトの声明</div> <div>この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、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>人気の記事</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/1796785841.html" title="アサシンのクリードシャドウズ:シーシェルリドルソリューション" class="phpgenera_Details_mainR4_bottom_title">アサシンのクリードシャドウズ:シーシェルリドルソリューション</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3週間前</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/1796789525.html" title="Windows11 KB5054979の新しいものと更新の問題を修正する方法" class="phpgenera_Details_mainR4_bottom_title">Windows11 KB5054979の新しいものと更新の問題を修正する方法</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>2週間前</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/1796785857.html" title="Atomfallのクレーンコントロールキーカードを見つける場所" class="phpgenera_Details_mainR4_bottom_title">Atomfallのクレーンコントロールキーカードを見つける場所</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3週間前</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/1796781206.html" title="R.E.P.O.で節約説明した(そしてファイルを保存)" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.で節約説明した(そしてファイルを保存)</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>1 か月前</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/1796783009.html" title="アサシンクリードシャドウ - 鍛冶屋を見つけて武器と鎧のカスタマイズを解除する方法" class="phpgenera_Details_mainR4_bottom_title">アサシンクリードシャドウ - 鍛冶屋を見つけて武器と鎧のカスタマイズを解除する方法</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>4週間前</span> <span>By DDD</span> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ja/article.html">もっと見る</a> </div> </div> </div> --> <div class="phpgenera_Details_mainR3"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hottools2.png" alt="" /> <h2>ホットAIツール</h2> </div> <div class="phpgenera_Details_mainR3_bottom"> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ja/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/ja/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_title"> <h3>Undresser.AI Undress</h3> </a> <p>リアルなヌード写真を作成する AI 搭載アプリ</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ja/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/ja/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_title"> <h3>AI Clothes Remover</h3> </a> <p>写真から衣服を削除するオンライン AI ツール。</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ja/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/ja/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_title"> <h3>Undress AI Tool</h3> </a> <p>脱衣画像を無料で</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ja/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/ja/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_title"> <h3>Clothoff.io</h3> </a> <p>AI衣類リムーバー</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ja/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/ja/ai/ai-hentai-generator" title="AI Hentai Generator" class="phpmain_tab2_mids_title"> <h3>AI Hentai Generator</h3> </a> <p>AIヘンタイを無料で生成します。</p> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ja/ai">もっと見る</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>人気の記事</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/1796785841.html" title="アサシンのクリードシャドウズ:シーシェルリドルソリューション" class="phpgenera_Details_mainR4_bottom_title">アサシンのクリードシャドウズ:シーシェルリドルソリューション</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3週間前</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/1796789525.html" title="Windows11 KB5054979の新しいものと更新の問題を修正する方法" class="phpgenera_Details_mainR4_bottom_title">Windows11 KB5054979の新しいものと更新の問題を修正する方法</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>2週間前</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/1796785857.html" title="Atomfallのクレーンコントロールキーカードを見つける場所" class="phpgenera_Details_mainR4_bottom_title">Atomfallのクレーンコントロールキーカードを見つける場所</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3週間前</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/1796781206.html" title="R.E.P.O.で節約説明した(そしてファイルを保存)" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.で節約説明した(そしてファイルを保存)</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>1 か月前</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/1796783009.html" title="アサシンクリードシャドウ - 鍛冶屋を見つけて武器と鎧のカスタマイズを解除する方法" class="phpgenera_Details_mainR4_bottom_title">アサシンクリードシャドウ - 鍛冶屋を見つけて武器と鎧のカスタマイズを解除する方法</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>4週間前</span> <span>By DDD</span> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ja/article.html">もっと見る</a> </div> </div> </div> <div class="phpgenera_Details_mainR3"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hottools2.png" alt="" /> <h2>ホットツール</h2> </div> <div class="phpgenera_Details_mainR3_bottom"> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ja/toolset/development-tools/92" title="メモ帳++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="メモ帳++7.3.1" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ja/toolset/development-tools/92" title="メモ帳++7.3.1" class="phpmain_tab2_mids_title"> <h3>メモ帳++7.3.1</h3> </a> <p>使いやすく無料のコードエディター</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ja/toolset/development-tools/93" title="SublimeText3 中国語版" 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 中国語版" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ja/toolset/development-tools/93" title="SublimeText3 中国語版" class="phpmain_tab2_mids_title"> <h3>SublimeText3 中国語版</h3> </a> <p>中国語版、とても使いやすい</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ja/toolset/development-tools/121" title="ゼンドスタジオ 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="ゼンドスタジオ 13.0.1" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ja/toolset/development-tools/121" title="ゼンドスタジオ 13.0.1" class="phpmain_tab2_mids_title"> <h3>ゼンドスタジオ 13.0.1</h3> </a> <p>強力な PHP 統合開発環境</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ja/toolset/development-tools/469" title="ドリームウィーバー 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="ドリームウィーバー CS6" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ja/toolset/development-tools/469" title="ドリームウィーバー CS6" class="phpmain_tab2_mids_title"> <h3>ドリームウィーバー CS6</h3> </a> <p>ビジュアル Web 開発ツール</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ja/toolset/development-tools/500" title="SublimeText3 Mac版" 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版" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ja/toolset/development-tools/500" title="SublimeText3 Mac版" class="phpmain_tab2_mids_title"> <h3>SublimeText3 Mac版</h3> </a> <p>神レベルのコード編集ソフト(SublimeText3)</p> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ja/ai">もっと見る</a> </div> </div> </div> <div class="phpgenera_Details_mainR4"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hotarticle2.png" alt="" /> <h2>ホットトピック</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ja/faq/gmailyxdlrkzn" title="Gmailメールのログイン入り口はどこですか?" class="phpgenera_Details_mainR4_bottom_title">Gmailメールのログイン入り口はどこですか?</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>7563</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/ja/faq/cakephp-tutor" title="CakePHP チュートリアル" class="phpgenera_Details_mainR4_bottom_title">CakePHP チュートリアル</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>1385</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/ja/faq/steamdzhmcssmgs" title="Steamのアカウント名の形式は何ですか" class="phpgenera_Details_mainR4_bottom_title">Steamのアカウント名の形式は何ですか</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>84</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/ja/faq/winactivationkeyper" title="Win11 Activation Key Permanent" class="phpgenera_Details_mainR4_bottom_title">Win11 Activation Key Permanent</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>61</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/ja/faq/newyorktimesdailybrief" title="NYTの接続はヒントと回答です" class="phpgenera_Details_mainR4_bottom_title">NYTの接続はヒントと回答です</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>28</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>99</span> </div> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ja/faq/zt">もっと見る</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/ja/faq/1796794743.html" title="MySQL:世界で最も人気のあるデータベースの紹介" 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/001/253/068/174438833021869.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="MySQL:世界で最も人気のあるデータベースの紹介" /> </a> <a href="https://www.php.cn/ja/faq/1796794743.html" title="MySQL:世界で最も人気のあるデータベースの紹介" class="phphistorical_Version2_mids_title">MySQL:世界で最も人気のあるデータベースの紹介</a> <span class="Articlelist_txts_time">Apr 12, 2025 am 12:18 AM</span> <p class="Articlelist_txts_p">MySQLはオープンソースのリレーショナルデータベース管理システムであり、主にデータを迅速かつ確実に保存および取得するために使用されます。その実用的な原則には、クライアントリクエスト、クエリ解像度、クエリの実行、返品結果が含まれます。使用法の例には、テーブルの作成、データの挿入とクエリ、および参加操作などの高度な機能が含まれます。一般的なエラーには、SQL構文、データ型、およびアクセス許可、および最適化の提案には、インデックスの使用、最適化されたクエリ、およびテーブルの分割が含まれます。</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ja/faq/1796795664.html" title="PHPとPython:2つの一般的なプログラミング言語を比較します" 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/001/253/068/174456083037147.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="PHPとPython:2つの一般的なプログラミング言語を比較します" /> </a> <a href="https://www.php.cn/ja/faq/1796795664.html" title="PHPとPython:2つの一般的なプログラミング言語を比較します" class="phphistorical_Version2_mids_title">PHPとPython:2つの一般的なプログラミング言語を比較します</a> <span class="Articlelist_txts_time">Apr 14, 2025 am 12:13 AM</span> <p class="Articlelist_txts_p">PHPとPythonにはそれぞれ独自の利点があり、プロジェクトの要件に従って選択します。 1.PHPは、特にWebサイトの迅速な開発とメンテナンスに適しています。 2。Pythonは、データサイエンス、機械学習、人工知能に適しており、簡潔な構文を備えており、初心者に適しています。</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ja/faq/1796795227.html" title="PHPの現在のステータス:Web開発動向を見てください" 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/001/253/068/174447480175194.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="PHPの現在のステータス:Web開発動向を見てください" /> </a> <a href="https://www.php.cn/ja/faq/1796795227.html" title="PHPの現在のステータス:Web開発動向を見てください" class="phphistorical_Version2_mids_title">PHPの現在のステータス:Web開発動向を見てください</a> <span class="Articlelist_txts_time">Apr 13, 2025 am 12:20 AM</span> <p class="Articlelist_txts_p">PHPは、現代のWeb開発、特にコンテンツ管理とeコマースプラットフォームで依然として重要です。 1)PHPには、LaravelやSymfonyなどの豊富なエコシステムと強力なフレームワークサポートがあります。 2)パフォーマンスの最適化は、Opcacheとnginxを通じて達成できます。 3)PHP8.0は、パフォーマンスを改善するためにJITコンパイラを導入します。 4)クラウドネイティブアプリケーションは、DockerおよびKubernetesを介して展開され、柔軟性とスケーラビリティを向上させます。</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ja/faq/1796794740.html" title="なぜMySQLを使用するのですか?利点と利点" 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/001/253/068/174438827027304.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="なぜMySQLを使用するのですか?利点と利点" /> </a> <a href="https://www.php.cn/ja/faq/1796794740.html" title="なぜMySQLを使用するのですか?利点と利点" class="phphistorical_Version2_mids_title">なぜMySQLを使用するのですか?利点と利点</a> <span class="Articlelist_txts_time">Apr 12, 2025 am 12:17 AM</span> <p class="Articlelist_txts_p">MySQLは、そのパフォーマンス、信頼性、使いやすさ、コミュニティサポートに選択されています。 1.MYSQLは、複数のデータ型と高度なクエリ操作をサポートし、効率的なデータストレージおよび検索機能を提供します。 2.クライアントサーバーアーキテクチャと複数のストレージエンジンを採用して、トランザクションとクエリの最適化をサポートします。 3.使いやすく、さまざまなオペレーティングシステムとプログラミング言語をサポートしています。 4.強力なコミュニティサポートを提供し、豊富なリソースとソリューションを提供します。</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ja/faq/1796795193.html" title="PHP:多くのウェブサイトの基礎" 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/001/253/068/174447407178624.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="PHP:多くのウェブサイトの基礎" /> </a> <a href="https://www.php.cn/ja/faq/1796795193.html" title="PHP:多くのウェブサイトの基礎" class="phphistorical_Version2_mids_title">PHP:多くのウェブサイトの基礎</a> <span class="Articlelist_txts_time">Apr 13, 2025 am 12:07 AM</span> <p class="Articlelist_txts_p">PHPが多くのWebサイトよりも優先テクノロジースタックである理由には、その使いやすさ、強力なコミュニティサポート、広範な使用が含まれます。 1)初心者に適した学習と使用が簡単です。 2)巨大な開発者コミュニティと豊富なリソースを持っています。 3)WordPress、Drupal、その他のプラットフォームで広く使用されています。 4)Webサーバーとしっかりと統合して、開発の展開を簡素化します。</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ja/faq/1796795223.html" title="MySQLの場所:データベースとプログラミング" 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/001/253/068/174447472119086.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="MySQLの場所:データベースとプログラミング" /> </a> <a href="https://www.php.cn/ja/faq/1796795223.html" title="MySQLの場所:データベースとプログラミング" class="phphistorical_Version2_mids_title">MySQLの場所:データベースとプログラミング</a> <span class="Articlelist_txts_time">Apr 13, 2025 am 12:18 AM</span> <p class="Articlelist_txts_p">データベースとプログラミングにおけるMySQLの位置は非常に重要です。これは、さまざまなアプリケーションシナリオで広く使用されているオープンソースのリレーショナルデータベース管理システムです。 1)MySQLは、効率的なデータストレージ、組織、および検索機能を提供し、Web、モバイル、およびエンタープライズレベルのシステムをサポートします。 2)クライアントサーバーアーキテクチャを使用し、複数のストレージエンジンとインデックスの最適化をサポートします。 3)基本的な使用には、テーブルの作成とデータの挿入が含まれ、高度な使用法にはマルチテーブル結合と複雑なクエリが含まれます。 4)SQL構文エラーやパフォーマンスの問題などのよくある質問は、説明コマンドとスロークエリログを介してデバッグできます。 5)パフォーマンス最適化方法には、インデックスの合理的な使用、最適化されたクエリ、およびキャッシュの使用が含まれます。ベストプラクティスには、トランザクションと準備された星の使用が含まれます</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ja/faq/1796795196.html" title="PHP:Web開発の重要な言語" 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/001/253/068/174447413070948.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="PHP:Web開発の重要な言語" /> </a> <a href="https://www.php.cn/ja/faq/1796795196.html" title="PHP:Web開発の重要な言語" class="phphistorical_Version2_mids_title">PHP:Web開発の重要な言語</a> <span class="Articlelist_txts_time">Apr 13, 2025 am 12:08 AM</span> <p class="Articlelist_txts_p">PHPは、サーバー側で広く使用されているスクリプト言語で、特にWeb開発に適しています。 1.PHPは、HTMLを埋め込み、HTTP要求と応答を処理し、さまざまなデータベースをサポートできます。 2.PHPは、ダイナミックWebコンテンツ、プロセスフォームデータ、アクセスデータベースなどを生成するために使用され、強力なコミュニティサポートとオープンソースリソースを備えています。 3。PHPは解釈された言語であり、実行プロセスには語彙分析、文法分析、編集、実行が含まれます。 4.PHPは、ユーザー登録システムなどの高度なアプリケーションについてMySQLと組み合わせることができます。 5。PHPをデバッグするときは、error_reporting()やvar_dump()などの関数を使用できます。 6. PHPコードを最適化して、キャッシュメカニズムを使用し、データベースクエリを最適化し、組み込み関数を使用します。 7</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ja/faq/1796795224.html" title="PHP対その他の言語:比較" 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/001/253/068/174447474158410.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="PHP対その他の言語:比較" /> </a> <a href="https://www.php.cn/ja/faq/1796795224.html" title="PHP対その他の言語:比較" class="phphistorical_Version2_mids_title">PHP対その他の言語:比較</a> <span class="Articlelist_txts_time">Apr 13, 2025 am 12:19 AM</span> <p class="Articlelist_txts_p">PHPは、特に迅速な開発や動的なコンテンツの処理に適していますが、データサイエンスとエンタープライズレベルのアプリケーションには良くありません。 Pythonと比較して、PHPはWeb開発においてより多くの利点がありますが、データサイエンスの分野ではPythonほど良くありません。 Javaと比較して、PHPはエンタープライズレベルのアプリケーションでより悪化しますが、Web開発により柔軟性があります。 JavaScriptと比較して、PHPはバックエンド開発により簡潔ですが、フロントエンド開発のJavaScriptほど良くありません。</p> </div> </div> <a href="https://www.php.cn/ja/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>福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!</p> </div> <div class="footermid"> <a href="https://www.php.cn/ja/about/us.html">私たちについて</a> <a href="https://www.php.cn/ja/about/disclaimer.html">免責事項</a> <a href="https://www.php.cn/ja/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?1745007928"></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>