cd helloWord
ls -l
total 32
-rw-r--r-- 1springspring2146 May 2619:28 config.m4
-rw-r--r-- 1springspring317 May 2619:28 config.w32
-rw-r--r-- 1springspring9 May 2619:28 CREDITS
-rw-r--r-- 1springspring0 May 2619:28 EXPERIMENTAL
-rw-r--r-- 1springspring5254 May 2619:28 helloWord.c
-rw-r--r-- 1springspring511 May 2619:28 helloWord.php
-rw-r--r-- 1springspring2937 May 2619:28 php_helloWord.h
drwxr-xr-x 2springspring4096 May 2619:28 tests
修改config.m4文件,
sudo vim config.m4
把代码
dnl PHP_ARG_WITH(helloWord, for helloWord support,
dnl Make sure thatthe comment is aligned:
dnl [ --with-helloWord Include helloWord support])
修改成
PHP_ARG_WITH(helloWord, whether to enable helloWord support,
Make sure thatthe comment is aligned:
[ --enable-helloWord Enable helloWord support])
const zend_function_entry helloWord_functions[] = {
PHP_FE(confirm_helloWord_compiled, NULL) /* For testing, remove later. */
PHP_FE_END /* Must be the last line in helloWord_functions[] */
};
PHP_FUNCTION(confirm_helloWord_compiled)
{
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, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "helloWord", arg);
RETURN_STRINGL(strg, len, 0);
}
修改成
const zend_function_entry helloWord_functions[] = {
PHP_FE(helloWord, NULL) /* For testing, remove later. */
PHP_FE_END /* Must be the last line in helloWord_functions[] */
};
PHP_FUNCTION(array_square_sum)
{
php_printf("Hello World!\n");
RETURN_TRUE;
}