如何直接使用ajax调用php类函数? [英] how to call a php class function directly using ajax?
问题描述
是否可以直接使用ajax调用php类函数?
Is it possible to call a php class function DIRECTLY using ajax?
类似下面的内容...除了ajax ...
Something like below... except ajax...
myclass::myfunction();
我一直在使用jquery库来处理AJAX.
I've been using the jquery library to work with AJAX.
$.get('control.php', {func: funcName, arg1: arg1});
以上内容与我要实现的减负control.php类似;
The above is similar to what I'm trying to achieve MINUS the control.php;
我不确定这是否可能,但是我只是想跳过接收funcName的登录页面(control.php)会很好.我有一堆条件语句,它们根据收到的funcName整理出要运行的类函数.
I'm not sure if this is even possible, but I just thought it would be nice to skip the landing page (control.php) that recieves the funcName. I have a bunch of conditional statements that sort out what class function to run based on the funcName recieved.
这样做似乎很愚蠢,只有一个单独的页面来处理函数调用.
It seems kind of silly to do this, to have a separate page just to handle function calls.
有更好的方法吗?
推荐答案
否.
如果可能的话,那将是一个巨大的安全漏洞.
If this were possible, it would be a gaping security hole.
这篇关于如何直接使用ajax调用php类函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!