The example in this article describes the method of php checking whether it is an ajax request. Share it with everyone for your reference. The details are as follows:
Through this code, you can determine whether the user's request comes from AJAX XMLHttpRequest to distinguish between ordinary post, get and ajax
function isAjax() { return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')); }
I hope this article will be helpful to everyone’s PHP programming design.