Record it.
Sometimes when writing test code, not used to directly output feedback on the screen, then you can configure the log file, the output needs to append to the log file, it is very convenient.
PHP comes with a log system, you can refer to the online blog configuration.
I would like to say that if you have more than one application under the Web server, all append log to a file, then, emmm ...
Workaround:
Create a dedicated log folder in each app, and append the content output to the file in the application. This method is very easy to think of. relatively simple.
First, for example, my application name is WX, so I built a logs folder inside, with two log files. After creating the file, it is best to use the chmod 777 Error.log command to elevate the file read and write permissions. Of course, it doesn't necessarily raise to 777. Also, the folder directly named logs in the production environment is not good, can be appropriately complicated naming, not easy to be guessed out.
Once the log file has been created, it is ready to be written in our code.
function successlog ($log) { $filegetcwd(). " /logs/success.log "; Var_dump ($file); $content Date Time $log ; file_put_contents ($file$content, file_append); }
$file to get the file, the absolute path is used here, and the relative path does not get the file. To enhance the portability of your application, you can use GETCWD to get the current path and assemble the required strings.
It is recommended that the current time be output when the log is output for easy viewing. Append to the log file, you can write "\ n" in the string to break the line.
PHP Add log file