例:
<table width="96%"border="0" align="center" cellpadding="4" cellspacing="0"> <tr onMouseOver="this.style.backgroundColor='#EAEAEA'; return true;" onMouseOut="this.style.backgroundColor='transparent';"> <td><a href="news_detail.php?infoId=141" class="link">新闻一</a></td> <td align="right" class="newstime">2014-03-12</td> </tr> <tr onMouseOver="this.style.backgroundColor='#EAEAEA'; return true;" onMouseOut="this.style.backgroundColor='transparent';"> <td><a href="news_detail.php?infoId=140" class="link">新闻二</a></td> <td align="right" class="newstime">2014-02-20</td> </tr></table>
<ul data-role="listview" > <li><a href="#">新闻一 2014-03-12</a></li> <li><a href="#">新闻二 2014-02-20</a></li> </ul>
まず一致します。次に、結果を組み立てます。
$s=<<< TXT<table width="96%"border="0" align="center" cellpadding="4" cellspacing="0"> <tr onMouseOver="this.style.backgroundColor='#EAEAEA'; return true;" onMouseOut="this.style.backgroundColor='transparent';"> <td><a href="news_detail.php?infoId=141" class="link">新闻一</a></td> <td align="right" class="newstime">2014-03-12</td> </tr> <tr onMouseOver="this.style.backgroundColor='#EAEAEA'; return true;" onMouseOut="this.style.backgroundColor='transparent';"> <td><a href="news_detail.php?infoId=140" class="link">新闻二</a></td> <td align="right" class="newstime">2014-02-20</td> </tr></table>TXT; preg_match_all('#]+>\s* ]+>(.+?) \s*]+>(.+?)<#s',$s,$m);$html=" \n";foreach($m[1] as $k=>$v) $html .= "
';echo $html;- $v {$m[2][$k]}
\n";$html .= 'ログイン後にコピーログイン後にコピーstr_replace を使用する方が良いです
最初に一致します。次に、結果を組み立てます。
すごいです
モデレーターの回答ありがとうございます
テストしてみましたが、本当にうまくいきました。
しかし、次の形式でハイパーリンクに特定のアドレスも含めたいと思っています。
$s=<<< TXT<table width="96%"border="0" align="center" cellpadding="4" cellspacing="0"> <tr onMouseOver="this.style.backgroundColor='#EAEAEA'; return true;" onMouseOut="this.style.backgroundColor='transparent';"> <td><a href="news_detail.php?infoId=141" class="link">新闻一</a></td> <td align="right" class="newstime">2014-03-12</td> </tr> <tr onMouseOver="this.style.backgroundColor='#EAEAEA'; return true;" onMouseOut="this.style.backgroundColor='transparent';"> <td><a href="news_detail.php?infoId=140" class="link">新闻二</a></td> <td align="right" class="newstime">2014-02-20</td> </tr></table>TXT; preg_match_all('#]+>\s* ]+>(.+?) \s*]+>(.+?)<#s',$s,$m);$html=" \n";foreach($m[1] as $k=>$v) $html .= "
';echo $html;- $v {$m[2][$k]}
\n";$html .= 'ログイン後にコピーログイン後にコピー
マスターモデレーター、通常のルールと FOREACH について大まかに説明していただけますか、ありがとう。
マスター、スコアが足りない場合は、追加しても構いません~~~~
ありがとうございます。
<ul data-role="listview" > <li><a href="news_detail.php?infoId=141">新闻一 2014-03-12</a></li> <li><a href="news_detail.php?infoId=140">新闻二 2014-02-20</a></li> </ulログイン後にコピーモデレーターはとても強力です~~~
いいね~
投稿しました、はぁ。このウェブサイトの声明この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。著者別の最新記事
2025-02-26 03:58:14 2025-02-26 03:38:10 2025-02-26 03:17:10 2025-02-26 02:49:09 2025-02-26 01:08:13 2025-02-26 00:46:10 2025-02-25 23:42:08 2025-02-25 22:50:13 2025-02-25 21:54:11 2025-02-25 20:45:11最新の問題関連トピック詳細>