如果我使用AJAX运行外部.PHP文件,它是否可以访问我的.PHP包含?

I'm sure this is a quickie. I have a PHP application I'm working on, and I'm designing the form validation/processing; the file will be called via AJAX.

My question is: when I call the form validation .PHP file via AJAX, will it have access to my previously declared .PHP includes?

For example, if I have a class User already included on the page calling the AJAX file, will I be able to call new User or User::authenticate inside my form validation .PHP?

Thanks.

Each invocation of php stands alone. It has no knowledge of what ran before it.

And it makes no difference that it's ajax. ajax calls are identical to simply browsing to the page regularly. It's just another way to display it in the browser, not another way to run php.

if you include it in your validation .PHP file yes, otherwise no

AJAX won't have any access to your PHP, it will merely have access to the output of your PHP. On the other hand, your PHP script will definitely have access on the included files.

You will be able to call new User, and then User::authenticate, but not only the last one alone.