Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
控制器中是否有办法确定该人是通过 AJAX 调用还是通过 HTTP 远程执行操作?然后显然为每个人执行不同的事情。
是的:
request.xhr?
true如果请求是 AJAX则返回,否则返回false。它相当于 call xml_http_request?,这是记录在案的方法。
true
false
xml_http_request?