PHP ファイルの文字列を置換 strtr(置換する文字列, 置換する連想配列)
目次
・
・
ファイルの文字列を複数置換 strtr(置換する文字列, 置換する連想配列)
$fileName = 'test.php';
$arrayReplace = array(
'testname.html' => 'testname_amp.html'
,'className' => 'className_amp'
);
$buff = file_get_contents($fileName);
$buff = strtr($buff, $arrayReplace);
file_put_contents($fileName, $buff);
ファイルの文字列を置換 strtr (置換する文字列, 置換前, 置換後)
この記事いいね
143
書き込み
info@aray.jp