string rpc_handle(
object reference &$obj, array $parameters)
|
|
Takes an object and the parameter list from a box call, executes
the specified method (a 'method' entry in the parameter list) with the rest of the values from the parameter list, and returns a serialized JavaScript variable, suitable for passing to the JavaScript eval() function.
This function operates independently of the others (ie. you do not need the calls to rpc_init() or rpc_response(). This function is used in conjunction with the new XMLHttpRequest-based RPC facilities in js/rpc.js.
Note: The following are reserved parameter names:
- error
- files
- method
- mode
- page
- param
Usage:
class Test { function hello ($name) { return 'hello ' . $name; } }
echo rpc_handle (new Test (), $parameters); exit;
Parameters
| object reference |
&$obj |
|
| array |
$parameters |
hash |
Creates a proper rpc server response out of the parameters passed to this function (uses func_get_args(), so pass it whatever you want).
Usage:
echo rpc_response (true); exit;
string rpc_serialize(
mixed $val)
|
|
Serialize the specified PHP data into a JavaScript-compatible string.
Properly handles strings, numbers, boolean values, objects, and arrays, but does not maintain key associations in arrays.