note 41389 added to zend.printing.phpinfo
| From: | jason dot lambert at uk dot clara dot net | Date: | Thu, 08 Apr 2004 09:40:03 +0000 |
| Subject: | note 41389 added to zend.printing.phpinfo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67814@lists.php.net to get a copy of this message | ||
That documentation didnt really explain anything to me, i went looking at the php source code to
work out how to do this.
For the benifit of anyone wishing to place information about their module in the output of
phpinfo(), here is how its done:
// define the special info function
ZEND_MINFO(firstmod);
//
// Now define our module entry
//
zend_module_entry firstmod_module_entry =
{
STANDARD_MODULE_HEADER,
"First Module",
firstmod_functions,
NULL, NULL, NULL, NULL,
ZEND_MINFO(firstmod), //this is for your phpinfo() function!
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES,
};
//
// Create a new function that handles phpinfo() stuff...
//
ZEND_MINFO_FUNCTION(firstmod)
{
char *somevalue = "blah blah";
php_info_print_table_start();
php_info_print_table_header(2, "Data", "Value");
// example using compiler macro
// for the build time/date
php_info_print_table_row(2, "Build Date", __DATE__);
php_info_print_table_row(2, "Build Time", __TIME__);
// you can use normal c variables and
// call external functions here as well..
php_info_print_table_row(2, "Some other stuff", somevalue);
php_info_print_table_end();
}
Have fun!
-------------------------
Jason Lambert
http://www.linuxforums.org/
----
Manual Page -- http://www.php.net/manual/en/zend.printing.phpinfo.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41389
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41389&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41389&report=yes
Search -- http://master.php.net/manage/user-notes.php