When logging with PHP, or Ajax request error, You Want To debug. We usually write information to a specified file. Then the problem is handled according to the corresponding information. For example, I like to add the following code $ fp = fopen ('. /a.txt ', 'a + B'); fwrite ($ fp, $ content); fclose ($ fp); however, there is a problem here. What if $ content is an array? You may say that I loop the output. What about multi-dimensional arrays? Is it so tiring for debugging. Here you can use var_export (). this function returns the structure information about the variables passed to this function. It is similar to var_dump (). The difference is that the returned representation is legal PHP code. You can set the second parameter of the function to TRUE to return the expression of the variable. $ Fp = fopen ('. /a.txt ', 'a + B'); fwrite ($ fp, var_export ($ content, true); fclose ($ fp); note var_export () the second parameter must be set to true to return the value. Otherwise, the output is directly. If your $ content is just an array and does not contain any other content, you can use print_r (), which is the same as print_r () the second parameter must also be set to true $ fp = fopen ('. /a.txt ', 'a + B'); fwrite ($ fp, print_r ($ content, true); fclose ($ fp );