When ajax calls php, the problem of debugging php code is a newbie. when I debug a program, when ajax calls php, code in php needs to be debugged, but in this case, the methods for writing logs, echo, print, and other information output in php code are invalid. & nbsp; do you know why? is there any way to debug the php code? Thank you ------ solution ------------------ you have the problem of debugging the php code when installing fire ajax to call php?
A newbie
I encountered a problem when debugging the program.
When ajax calls php, you need to debug the code in php.
However, in this case, the methods for writing logs, echo, print, and other information in php code are invalid.
Do you know why?
Is there any way to Debug php code?
Thank you.
------ Solution --------------------
Have you installed firebug? Echo debugging is fine.
If an exception alert (msg) exists in try catch after ajax is returned.
------ Solution --------------------
Put_file_contents ('C: \ error.txt ', $ string); // save it to an external file. $ string indicates the variable you suspect is faulty.
This code may not be placed at the end of the page. If it cannot be saved as a file, it indicates that there is a problem with your previous code. move this sentence a few lines up. if it can be saved, your $ string is the value you want, skip this variable and move the code down.
Stupid way to exchange experiences.
------ Solution --------------------
Debugging ajax + php without tools is quite difficult.
It needs to be debugged in stages. the js part is relatively simple and there will be no problems after planning.
Debugging in php is no different from debugging on common pages, as long as there is no error message or data format that complies with the conventions.
Ajax is nothing more than getting data through get and post requests. You can design a form to replace xmlhttp sending. because the page is visible, it is easy to find problems.