📄 info.c
字号:
memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol, stream_protocol_len); stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len] = ','; stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len + 1] = ' '; stream_protocols_buf_len += stream_protocol_len + 2; } if (stream_protocols_buf) { stream_protocols_buf[stream_protocols_buf_len - 2] = ' '; stream_protocols_buf[stream_protocols_buf_len] = 0; php_info_print_table_row(2, "Registered PHP Streams", stream_protocols_buf); efree(stream_protocols_buf); } else { /* Any chances we will ever hit this? */ php_info_print_table_row(2, "Registered PHP Streams", "no streams registered"); } } else { /* Any chances we will ever hit this? */ php_info_print_table_row(2, "PHP Streams", "disabled"); /* ?? */ } } php_info_print_table_end(); /* Zend Engine */ php_info_print_box_start(0); if (expose_php && !sapi_module.phpinfo_as_text) { PUTS("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\""); if (SG(request_info).request_uri) { char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC); PUTS(elem_esc); efree(elem_esc); } PUTS("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n"); } PUTS("This program makes use of the Zend Scripting Language Engine:"); PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n"); PUTS(zend_version); php_info_print_box_end(); efree(php_uname); } if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) { php_info_print_hr(); PUTS("<h1><a href=\""); if (SG(request_info).request_uri) { char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC); PUTS(elem_esc); efree(elem_esc); } PUTS("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">"); PUTS("PHP Credits"); PUTS("</a></h1>\n"); } zend_ini_sort_entries(TSRMLS_C); if (flag & PHP_INFO_CONFIGURATION) { php_info_print_hr(); if (!sapi_module.phpinfo_as_text) { PUTS("<h1>Configuration</h1>\n"); } else { SECTION("Configuration"); } SECTION("PHP Core"); display_ini_entries(NULL); } if (flag & PHP_INFO_MODULES) { int show_info_func; HashTable sorted_registry; zend_module_entry tmp; zend_hash_init(&sorted_registry, 50, NULL, NULL, 1); zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, sizeof(zend_module_entry)); zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC); show_info_func = 1; zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) _display_module_info, &show_info_func TSRMLS_CC); SECTION("Additional Modules"); php_info_print_table_start(); php_info_print_table_header(1, "Module Name"); show_info_func = 0; zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) _display_module_info, &show_info_func TSRMLS_CC); php_info_print_table_end(); zend_hash_destroy(&sorted_registry); } if (flag & PHP_INFO_ENVIRONMENT) { SECTION("Environment"); php_info_print_table_start(); php_info_print_table_header(2, "Variable", "Value"); for (env=environ; env!=NULL && *env !=NULL; env++) { tmp1 = estrdup(*env); if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */ efree(tmp1); continue; } *tmp2 = 0; tmp2++; php_info_print_table_row(2, tmp1, tmp2); efree(tmp1); } php_info_print_table_end(); } if (flag & PHP_INFO_VARIABLES) { pval **data; SECTION("PHP Variables"); php_info_print_table_start(); php_info_print_table_header(2, "Variable", "Value"); if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) { php_info_print_table_row(2, "PHP_SELF", Z_STRVAL_PP(data)); } if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) { php_info_print_table_row(2, "PHP_AUTH_TYPE", Z_STRVAL_PP(data)); } if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) { php_info_print_table_row(2, "PHP_AUTH_USER", Z_STRVAL_PP(data)); } if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) { php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data)); } php_print_gpcse_array("_REQUEST", sizeof("_REQUEST")-1 TSRMLS_CC); php_print_gpcse_array("_GET", sizeof("_GET")-1 TSRMLS_CC); php_print_gpcse_array("_POST", sizeof("_POST")-1 TSRMLS_CC); php_print_gpcse_array("_FILES", sizeof("_FILES")-1 TSRMLS_CC); php_print_gpcse_array("_COOKIE", sizeof("_COOKIE")-1 TSRMLS_CC); php_print_gpcse_array("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC); php_print_gpcse_array("_ENV", sizeof("_ENV")-1 TSRMLS_CC); php_info_print_table_end(); } if (flag & PHP_INFO_LICENSE) { if (!sapi_module.phpinfo_as_text) { SECTION("PHP License"); php_info_print_box_start(0); PUTS("<p>\n"); PUTS("This program is free software; you can redistribute it and/or modify "); PUTS("it under the terms of the PHP License as published by the PHP Group "); PUTS("and included in the distribution in the file: LICENSE\n"); PUTS("</p>\n"); PUTS("<p>"); PUTS("This program is distributed in the hope that it will be useful, "); PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of "); PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); PUTS("</p>\n"); PUTS("<p>"); PUTS("If you did not receive a copy of the PHP license, or have any questions about "); PUTS("PHP licensing, please contact license@php.net.\n"); PUTS("</p>\n"); php_info_print_box_end(); } else { PUTS("\nPHP License\n"); PUTS("This program is free software; you can redistribute it and/or modify\n"); PUTS("it under the terms of the PHP License as published by the PHP Group\n"); PUTS("and included in the distribution in the file: LICENSE\n"); PUTS("\n"); PUTS("This program is distributed in the hope that it will be useful,\n"); PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); PUTS("\n"); PUTS("If you did not receive a copy of the PHP license, or have any\n"); PUTS("questions about PHP licensing, please contact license@php.net.\n"); } } if (!sapi_module.phpinfo_as_text) { PUTS("</div></body></html>"); }}/* }}} */PHPAPI void php_info_print_table_start(){ if (!sapi_module.phpinfo_as_text) { php_printf("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n"); } else { php_printf("\n"); }}PHPAPI void php_info_print_table_end(){ if (!sapi_module.phpinfo_as_text) { php_printf("</table><br />\n"); }}PHPAPI void php_info_print_box_start(int flag){ php_info_print_table_start(); if (flag) { if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"h\"><td>\n"); } } else { if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"v\"><td>\n"); } else { php_printf("\n"); } }}PHPAPI void php_info_print_box_end(){ if (!sapi_module.phpinfo_as_text) { php_printf("</td></tr>\n"); } php_info_print_table_end();}PHPAPI void php_info_print_hr(){ if (!sapi_module.phpinfo_as_text) { php_printf("<hr />\n"); } else { php_printf("\n\n _______________________________________________________________________\n\n"); }}PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header){ int spaces; if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"h\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header ); } else { spaces = (74 - strlen(header)); php_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " "); }}/* {{{ php_info_print_table_header */PHPAPI void php_info_print_table_header(int num_cols, ...){ int i; va_list row_elements; char *row_element; TSRMLS_FETCH(); va_start(row_elements, num_cols); if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"h\">"); } for (i=0; i<num_cols; i++) { row_element = va_arg(row_elements, char *); if (!row_element || !*row_element) { row_element = " "; } if (!sapi_module.phpinfo_as_text) { PUTS("<th>"); PUTS(row_element); PUTS("</th>"); } else { PUTS(row_element); if (i < num_cols-1) { PUTS(" => "); } else { PUTS("\n"); } } } if (!sapi_module.phpinfo_as_text) { php_printf("</tr>\n"); } va_end(row_elements);}/* }}} *//* {{{ php_info_print_table_row */PHPAPI void php_info_print_table_row(int num_cols, ...){ int i; va_list row_elements; char *row_element; char *elem_esc = NULL;/* int elem_esc_len;*/ TSRMLS_FETCH(); va_start(row_elements, num_cols); if (!sapi_module.phpinfo_as_text) { php_printf("<tr>"); } for (i=0; i<num_cols; i++) { if (!sapi_module.phpinfo_as_text) { php_printf("<td class=\"%s\">", (i==0 ? "e" : "v" ) ); } row_element = va_arg(row_elements, char *); if (!row_element || !*row_element) { if (!sapi_module.phpinfo_as_text) { PUTS( "<i>no value</i>" ); } else { PUTS( " " ); } } else { if (!sapi_module.phpinfo_as_text) { elem_esc = php_info_html_esc(row_element TSRMLS_CC); PUTS(elem_esc); efree(elem_esc); } else { PUTS(row_element); if (i < num_cols-1) { PUTS(" => "); } } } if (!sapi_module.phpinfo_as_text) { php_printf(" </td>"); } else if (i == (num_cols - 1)) { PUTS("\n"); } } if (!sapi_module.phpinfo_as_text) { php_printf("</tr>\n"); } va_end(row_elements);}/* }}} *//* {{{ register_phpinfo_constants */void register_phpinfo_constants(INIT_FUNC_ARGS){ REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS);}/* }}} *//* {{{ proto void phpinfo([int what]) Output a page of useful information about PHP and the current request */PHP_FUNCTION(phpinfo){ int argc = ZEND_NUM_ARGS(); long flag; if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) { return; } if(!argc) { flag = PHP_INFO_ALL; } /* Andale! Andale! Yee-Hah! */ php_start_ob_buffer(NULL, 4096, 0 TSRMLS_CC); php_print_info(flag TSRMLS_CC); php_end_ob_buffer(1, 0 TSRMLS_CC); RETURN_TRUE;}/* }}} *//* {{{ proto string phpversion([string extension]) Return the current PHP version */PHP_FUNCTION(phpversion){ zval **arg; int argc = ZEND_NUM_ARGS(); if (argc == 0) { RETURN_STRING(PHP_VERSION, 1); } else if (argc == 1 && zend_get_parameters_ex(1, &arg) == SUCCESS) { char *version; convert_to_string_ex(arg); version = zend_get_module_version(Z_STRVAL_PP(arg)); if (version == NULL) { RETURN_FALSE; } RETURN_STRING(version, 1); } else { WRONG_PARAM_COUNT; }}/* }}} *//* {{{ proto void phpcredits([int flag]) Prints the list of people who've contributed to the PHP project */PHP_FUNCTION(phpcredits){ int argc = ZEND_NUM_ARGS(); long flag; if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) { return; } if(!argc) { flag = PHP_CREDITS_ALL; } php_print_credits(flag); RETURN_TRUE;}/* }}} *//* {{{ proto string php_logo_guid(void) Return the special ID used to request the PHP logo in phpinfo screens*/PHP_FUNCTION(php_logo_guid){ if (ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1);}/* }}} *//* {{{ proto string php_egg_logo_guid(void) Return the special ID used to request the PHP logo in phpinfo screens*/PHP_FUNCTION(php_egg_logo_guid){ if (ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1);}/* }}} *//* {{{ proto string zend_logo_guid(void) Return the special ID used to request the Zend logo in phpinfo screens*/PHP_FUNCTION(zend_logo_guid){ if (ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1);}/* }}} *//* {{{ proto string php_sapi_name(void) Return the current SAPI module name */PHP_FUNCTION(php_sapi_name){ if (ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } if (sapi_module.name) { RETURN_STRING(sapi_module.name, 1); } else { RETURN_FALSE; }}/* }}} *//* {{{ proto string php_uname(void) Return information about the system PHP was built on */PHP_FUNCTION(php_uname){ char *mode = "a"; int modelen; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) { return; } RETURN_STRING(php_get_uname(*mode), 0);}/* }}} *//* {{{ proto string php_ini_scanned_files(void) Return comma-separated string of .ini files parsed from the additional ini dir */PHP_FUNCTION(php_ini_scanned_files) { if(strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) { RETURN_STRING(php_ini_scanned_files,1); } else RETURN_FALSE;}/* }}} *//* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: sw=4 ts=4 fdm=marker * vim<600: sw=4 ts=4 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -