関数で文字を変えてみます
<?php
$string = "Hi everybody people [gal~images/articles~100~100~4] here other imagen [gal~images/products~100~100~3]";
$regex = "/\[(.*?)\]/";
preg_match_all($regex, $string, $matches);
for($i=0; $i<count($matches[1]);$i++)
{
$match = $matches[1][$i];
$array = explode('~', $match);
//$newValuet="gal("".$array[1]."","".$array[2]."","".$array[3]."","".$array[4]."")";
$newValue="gal(".$array[1].",".$array[2].",".$array[3].",".$array[4].")";
$string = str_replace($matches[0][$i],$newValue,$string);
}
echo $string;
?>
ここでの問題:
$newValue="gal(".$array[1].",".$array[2].",".$array[3].",".$array[4].")";
$string = str_replace($matches[0][$i],$newValue,$string);
関数は正しい結果を与えません。さまざまな方法を試しますが、問題を続けます。すべての関数が表示されますが、これが機能しません。答えられる場合は、このコードを変更してください。理解できるようにします。すべての助けに感謝します。
詳しくは
スクリプトは新しい値を生成します。この値は、insert および show replace tags と put all well 、show text および tags replace のために Gall の関数を送信する必要があります。
$newValue="gal(".$array[1].",".$array[2].",".$array[3].",".$array[4].")";
$string = str_replace($matches[0][$i],$newValue,$string);
ここで、関数は gal を表示します。関数は、str_replace に実行してテキストを配置する必要がある場合に実行されます。タグを置換して続行する前に、これだけが失敗します。
PD : 私 は 何 人 か の 人 に 敬意 を 払い ます . 私 は ここ に 質問 を 送り ます .学ぶか、助けが必要で、明日は他の人やこの人を助けることができます。
よろしく