我有要编辑的文件,其中包含:
Categories,
Diamond,10,11,
Coal,21,21,
如何在包含“钻石”的行尾添加字符串?
我所拥有的是可以在文件末尾添加字符串但不知道如何使其在特定行中添加该字符串的代码:
$function_Result = mysql_fetch_row($function_Ask, 0);
$file_To_Edit = "item_Data.csv";
$opened_File = fopen($file_To_Edit, 'w') or die("Error. Code:2 - Can not open file $file_To_Edit");
$string_Data = $function_Result[0] . ",";
fwrite($opened_File, $string_Data);
fclose($opened_File);