php扩展开发-MINFO
2024-08-24 11:27:31
我们在用PHPinfo函数或命令行的php -i命令查看php环境相关的信息,当我们开发完成一个自己的扩展,除非这个扩展就是你自己所使用,否则你就需要对扩展进行相关的介绍,或者显示扩展用到的ini配置,这个时候你就可以使用MINFO的函数,把你想展示的信息通过它来等记,最后在phpinfo或php-i中别人可以看到这些信息。
PHP_MINFO_FUNCTION(myext);//php_myext.h //你想展示的扩展信息
PHP_MINFO_FUNCTION(myext){
//这里面的内容其实就printf输出,只是php内核提供了一些封装好的函数,方便我们输出
php_info_print_table_start();
php_info_print_table_row(, "version", PHP_MYEXT_VERSION);
php_info_print_table_row(, "writer", "zhangxiaomin");
php_info_print_table_end();
} zend_module_entry myext_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
"myext",//扩展名称
myext_functions,//zend_function_entry myext_functions 定义好的函数扩展变量
PHP_MINIT(myext),//MINIT_FUNCTION
NULL,//MSHUTDOWN_FUNCTION
NULL,//RINIT_FUNCTION
NULL,//RSHUTDOWN_FUNCTION
PHP_MINFO(myext),//MINFO_FUNCTION,在这里注册PHP_MINFO_FUNCTION
#if ZEND_MODULE_API_NO >= 20010901
PHP_MYEXT_VERSION,
#endif
STANDARD_MODULE_PROPERTIES
};
//ext/standard/info.h
//这些函数已经对cli或HTML的环境做了处理,会分别显示对应的文本内容 PHPAPI char *php_info_html_esc(char *string TSRMLS_DC);
PHPAPI void php_info_html_esc_write(char *string, int str_len TSRMLS_DC);
PHPAPI void php_print_info_htmlhead(TSRMLS_D);
PHPAPI void php_print_info(int flag TSRMLS_DC);
PHPAPI void php_print_style(void);
PHPAPI void php_info_print_style(TSRMLS_D);
PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header);
PHPAPI void php_info_print_table_header(int num_cols, ...);
PHPAPI void php_info_print_table_row(int num_cols, ...);
PHPAPI void php_info_print_table_row_ex(int num_cols, const char *, ...);
PHPAPI void php_info_print_table_start(void);
PHPAPI void php_info_print_table_end(void);
PHPAPI void php_info_print_box_start(int bg);
PHPAPI void php_info_print_box_end(void);
PHPAPI void php_info_print_hr(void);
PHPAPI void php_info_print_module(zend_module_entry *module TSRMLS_DC);
最新文章
- 为什么 MySQL 回滚事务也会导致 ibd 文件增大?
- list 集合
- linux chmod 命令
- 十八、Java基础--------IO流体系以及字符流
- CodeIgniter框架中关于URL(index.php)的那些事
- 解密SQL SERVER 2005加密存储过程,函数
- vi使用教程
- S5PV210启动过程分析
- HTML5简单入门系列(四)
- lda模型的python实现
- cocostudio——js 3 final控件事件
- C#嵌套类
- 深度学习梯度反向传播出现Nan值的原因归类
- js静态方法与实例方法定义,js回调方法定义
- 内核中的锁机制--RCU
- java学习笔记37(sql工具类:JDBCUtils)
- WordCount 程序的实现
- tpshop防止sql注入补丁
- 【CS231N】4、神经网络
- 【LeetCode】153. Find Minimum in Rotated Sorted Array (3 solutions)