私は、2つのタグの間でデータを置き換える時間がある。私はこのパターンに一致する正規表現を理解することはできません。 My tags are simply <!-- Model # Start --> and <!-- Model # End -->
PHP Regexでタグ間を置換
コード:
$products[''.$row[0].''][2] = preg_replace("/(<!-- Model # Start -->).*(<!-- Model # End -->)/i", "$1$2", $products[''.$row[0].''][2]);
echo $products[''.$row[0].''][2] . "\n";
データ:[ '$行[0]' ''] $製品[2]
Economical. 7 mils thick, tough & stretchy. Each roll cellophane wrapped. UL listed.
<!-- Model # Start -->
<p style='text-align: right;'>16736</p>
<!-- Model # End -->
空の文字列を連結する目的は何ですか? '$ products [''。$ row [0]。 '']'。 '(string)'のようなものを取得しようとしていますか? – alex