如果zval是可调用对象,我该如何在扩展名c代码中运行它?
或如何将zval
转换为zend_fcall_info
答案 0 :(得分:1)
搜索zend_is_callable
并深入了解php src代码后,我知道如何调用可调用的zval:
zval ret;
zval* params[] = { param }; // param is zval* too
if (SUCCESS == call_user_function(CG(function_table), NULL, callable, &retval, 1, params TSRMLS_CC)) {
// callable is a zval*
// you can do something with the retval now
}