-3

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?

4

3 回答 3

1

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 ?

于 2013-01-28T11:01:41.733 回答
0

通过 GET 方法将函数名称发送到 php 页面,然后使用执行 _GET 值call_user_func

http://php.net/manual/en/function.call-user-func.php

于 2013-01-28T11:02:13.167 回答
0

你可以使用call_user_func()

$name = $_POST['function'];

if (in_array($name, $allowed_functions)) {
    $result = call_user_func($name);
}

虽然这个设计很糟糕。为什么需要这样做?

于 2013-01-28T11:02:46.443 回答