note 41389 deleted from zend.printing.phpinfo by nlopess
| From: | nlopess@php.net | Date: | Tue, 01 May 2007 13:24:52 +0000 |
| Subject: | note 41389 deleted from zend.printing.phpinfo by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126018@lists.php.net to get a copy of this message | ||
Note Submitter: jason dot lambert at uk dot clara dot net
----
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/