私はPHP経由でCSVファイルを処理しようとしています。私はそれを動作させています。しかし、私は条件のセットに基づいて変更する必要があるこの1つの配列があります。elseif indie whileループ
$file_handle = fopen($path, "r");
while (!feof($file_handle)) {
$line_of_text = fgetcsv($file_handle, 100000);
if($currency == "US"){
$line_of_text[6] = str_replace ("if_you_find_this","change_to_this",$line_of_text[6]);
$line_of_text[6] = str_replace ("if_you_find_this","change_to_this",$line_of_text[6]);
} elseif($currency == "DE"){
$line_of_text[6] = str_replace ("if_you_find_this","change_to_this",$line_of_text[6]);
$line_of_text[6] = str_replace ("if_you_find_this","change_to_this",$line_of_text[6]);
}else {
echo "Something with currency handling went wrong. Please contact support.";
}
$data .= $line_of_text[0] . "," . $line_of_text[1] . "," . $line_of_text[2] . "," . $line_of_text[4] . "," . $line_of_text[6] . "," . $line_of_text[49] . "," . $line_of_text[51] . "\n";
}
fclose($file_handle);
$new_file_handle = fopen($path, "w");
fwrite($new_file_handle, $data);
エラーは発生しませんが、条件ブロック全体が無視されているようです。助けて?
すでに作業ファイルに入っている重要な行に貼り付けるのを忘れた - > $ line_of_text = fgetcsv($ file_handle、100000); – jeffimperial