Possible Duplicate:
Call PHP Function using jQuery AJAX
I have a PHP file containing all functions created by me. I just want to know, how can I call a specific function through Ajax?
Possible Duplicate:
Call PHP Function using jQuery AJAX
I have a PHP file containing all functions created by me. I just want to know, how can I call a specific function through Ajax?
You could pass a get or post variable and use it to then using php call a specific function. WHat exactly are you trying to achieve ?
通过 GET 方法将函数名称发送到 php 页面,然后使用执行 _GET 值call_user_func
你可以使用call_user_func()
:
$name = $_POST['function'];
if (in_array($name, $allowed_functions)) {
$result = call_user_func($name);
}
虽然这个设计很糟糕。为什么需要这样做?