Home  >  Article  >  Backend Development  >  PHP c 扩展,调用php函数

PHP c 扩展,调用php函数

WBOY
WBOYOriginal
2016-06-23 14:29:381110browse

c:

zval *argvs[2]; zval *func; MAKE_STD_ZVAL(func); MAKE_STD_ZVAL(argvs[0]); MAKE_STD_ZVAL(argvs[1]); ZVAL_LONG(argvs[0], 317); ZVAL_STRING(argvs[1], "Lein's birthday is ",1); ZVAL_STRING(func, "callme",1); if (call_user_function(EG(function_table), NULL, func, &retval, 2, argvs) == SUCCESS) { zval_dtor(&retval); }

 

php:

function callme($day,$str) { echo $str.": ".$day."/n"; }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn