PHP_FUNCTION(roger_test) { char *arg = NULL; int arg_len, len; char *strg; if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "s", &arg, &arg_len) == FAILURE){ return; } len = spprintf(&strg, 0, "your input string: %s\n", arg); RETURN_STRINGL(strg, len, 0); }
在PHP脚本里面直接调用roger_test(”hello kitty! “),结果: