別のファイルの変数を置き換える必要があるファイルに取り組んでいます。これまでのところ、私は試しました:
$File = "$dir/submit.php";
$fh = fopen($File, 'r') or die("Couldn't edit the Config-file. Please report to admin.");
$chosendb = str_replace('$chosendb = comments;','$chosendb = wuhuws_$dir;','$chosendb');
fclose($fh);
$dir はユーザー入力です。コメントは、prefix_$dir に置き換える必要があるデータベース内のテーブルです。
私は何を間違っていますか?