V
V
vovochka4042011-12-05 10:53:29
PHP
vovochka404, 2011-12-05 10:53:29

Checking output redirection in PHP?

How to check if stdout is redirected or not?
The bottom line is, there is a color output. In the console, it is good and colorful, but not in a text file.
If the output is redirected to a file, I want to remove the coloring. How to check where the output goes?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Gribozavr, 2011-12-05
@vovochka404

man 3 isatty

M
Max, 2011-12-05
@7workers

not sure if it will work, but came up with the idea of ​​parsing the command line (can be found in /proc/PID/cmdline on redhat linux)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question