使用PHP将查询字符串值写入.txt文件并保存[duplicate]

This question already has an answer here:

I am able to take the values from a URL's query string and store them in some variables, however I would also like to print or write these values to a single line in a .txt document, and save that document in a given directory on the server.

Each time the page is loaded with a new query string, a new line will be added to that .txt file with the string values, and the file re-saved.

Can this be done? Struggling to find answers to this in my searches.

Many thanks in advance.

</div>

As simple as:

$url_value = "This is some value
";
file_put_contents("/your/filename/here.txt", $url_value, FILE_APPEND );

See file_put_contents() for more information.