I want to redirect echo command output to a text file.My PHP code contain echo $TOKEN;Here $TOKEN contains variable value i want to write this value into a text file. Any one can help on this.
Thanks in adavance.
Just use fopen/fwrite to write to a file (this will create the output.txt if it does not exist, else overwrites it)
$myfile = fopen("output.txt", "w") or die("Unable to open file!");
fwrite($myfile, $TOKEN);
fclose($myfile);
try standard bash notation:
php script.php > file.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With