[PHP] PHP Extension开发基础 →→→→→进入此内容的聊天室

来自 , 2020-07-05, 写在 PHP, 查看 137 次.
URL http://www.code666.cn/view/ffbd6cbb
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5                                                        |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2010 The PHP Group                                |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license,      |
  8. | that is bundled with this package in the file LICENSE, and is        |
  9. | available through the world-wide-web at the following url:           |
  10. | http://www.php.net/license/3_01.txt                                  |
  11. | If you did not receive a copy of the PHP license and are unable to   |
  12. | obtain it through the world-wide-web, please send a note to          |
  13. | license@php.net so we can mail you a copy immediately.               |
  14. +----------------------------------------------------------------------+
  15. | Author: ZhangYang                          |
  16. +----------------------------------------------------------------------+
  17. */
  18. /* $Id: header 297205 2010-03-30 21:09:07Z johannes $ */
  19. #ifdef HAVE_CONFIG_H
  20. #include "config.h"
  21. #endif
  22. #include "php.h"
  23. #include "php_ini.h"
  24. #include "ext/standard/info.h"
  25. #include "php_say_hello.h"
  26. /* If you declare any globals in php_say_hello.h uncomment this:
  27. ZEND_DECLARE_MODULE_GLOBALS(say_hello)
  28. */
  29. /* True global resources - no need for thread safety here */
  30. static int le_say_hello;
  31. /* {{{ PHP_FUNCTION
  32. */
  33. PHP_FUNCTION(say_hello_func)
  34. {
  35.     char *name;
  36.     int name_len;
  37.     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE)
  38.     {
  39.         return;
  40.     }
  41.     php_printf("Hello %s!", name);
  42.     RETURN_TRUE;
  43. }
  44. ZEND_BEGIN_ARG_INFO(arginfo_say_hello_func, 0)
  45. ZEND_END_ARG_INFO()
  46. /* }}} */
  47. /* {{{ say_hello_functions[]
  48. *
  49. * Every user visible function must have an entry in say_hello_functions[].
  50. */
  51. const zend_function_entry say_hello_functions[] = {
  52.     PHP_FE(say_hello_func, arginfo_say_hello_func)
  53.     {NULL, NULL, NULL} /* Must be the last line in say_hello_functions[] */
  54. };
  55. /* }}} */
  56. /* {{{ say_hello_module_entry
  57. */
  58. zend_module_entry say_hello_module_entry = {
  59.     #if ZEND_MODULE_API_NO >= 20010901
  60.    STANDARD_MODULE_HEADER,
  61.     #endif
  62.    "say_hello",
  63.     say_hello_functions,
  64.     NULL,
  65.     NULL,
  66.     NULL,
  67.     NULL,
  68.     PHP_MINFO(say_hello),
  69.     #if ZEND_MODULE_API_NO >= 20010901
  70.    "0.1", /* Replace with version number for your extension */
  71.     #endif
  72.    STANDARD_MODULE_PROPERTIES
  73. };
  74. /* }}} */
  75. #ifdef COMPILE_DL_SAY_HELLO
  76. ZEND_GET_MODULE(say_hello)
  77. #endif
  78. /* {{{ PHP_MINFO_FUNCTION
  79. */
  80. PHP_MINFO_FUNCTION(say_hello)
  81. {
  82.     php_info_print_table_start();
  83.     php_info_print_table_header(2, "say_hello support", "enabled");
  84.     php_info_print_table_row(2, "author", "Zhang Yang"); /* Replace with your name */
  85.     php_info_print_table_end();
  86.     /* Remove comments if you have entries in php.ini
  87.     DISPLAY_INI_ENTRIES();
  88.     */
  89. }
  90. /* }}} */

回复 "PHP Extension开发基础"

这儿你可以回复上面这条便签

captcha