Documentos de Académico
Documentos de Profesional
Documentos de Cultura
PHP Info
PHP Info
phpinfo ( int $flags=INFO_ALL ): bool
Genera una gran cantidad de información sobre el estado actual de PHP. Esto incluye información
sobre las opciones y extensiones de compilación de PHP, la versión de PHP, la información del servidor
y el entorno (si se compila como un módulo), el entorno de PHP, información de la versión del sistema
operativo, rutas, valores maestros y locales de las opciones de configuración, encabezados HTTP y
PHP. Licencia.
Debido a que cada sistema se configura de manera diferente, phpinfo () se usa comúnmente para
verificar los ajustes de configuración y las variables predefinidas disponibles en un sistema dado.
phpinfo () también es una valiosa herramienta de depuración ya que contiene todos los datos de
EGPCS (Environment, GET, POST, Cookie, Server).
Parámetros ¶
flags
La salida se puede personalizar pasando una o más de las siguientes constantes valores bit a bit
sumados en el flagsparámetro opcional . También se pueden combinar las constantes respectivas
o los valores bit a bit junto con el bit a bit o el operador .
opciones de phpinfo ()
Nombre (constante) Valor Descripción
La línea de configuración, la ubicación de php.ini , la fecha de
INFO_GENERAL 1
compilación, el servidor web, el sistema y más.
INFO_CREDITS 2 Créditos PHP. Consulte también phpcredits () .
INFO_CONFIGURATI Valores locales y maestros actuales para las directivas
4
ON PHP. Consulte también ini_get () .
Módulos cargados y sus respectivas configuraciones. Consulte
INFO_MODULES 8
también get_loaded_extensions () .
INFO_ENVIRONMEN Información de la variable de entorno que también está
dieciséis
T disponible en $ _ENV .
Muestra todas las variables predefinidas de EGPCS (Entorno,
INFO_VARIABLES 32
GET, POST, Cookie, Servidor).
Información de licencia PHP. Consulte también las »preguntas
INFO_LICENSE 64
frecuentes sobre licencias .
INFO_ALL -1 Muestra todo lo anterior.
Valores devueltos ¶
// Show all information, defaults to INFO_ALL
phpinfo();
// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);
?>
Notas ¶
Nota :
En las versiones de PHP anteriores a 5.5, parte de la información mostrada se deshabilita
cuando el ajuste de configuración expose_php está establecido en off. Esto incluye los
logotipos de PHP y Zend, y los créditos.
Nota :
phpinfo () genera texto sin formato en lugar de HTML cuando se usa el modo CLI.
Ver también ¶
abajo
9
Phelon Dudras ¶
Hace 12 años
A simple method to style your own phpinfo() output.
<style type="text/css">
#phpinfo {}
#phpinfo pre {}
#phpinfo a:link {}
#phpinfo a:hover {}
#phpinfo table {}
#phpinfo .center {}
#phpinfo .center table {}
#phpinfo .center th {}
#phpinfo td, th {}
#phpinfo h1 {}
#phpinfo h2 {}
#phpinfo .p {}
#phpinfo .e {}
#phpinfo .h {}
#phpinfo .v {}
#phpinfo .vr {}
#phpinfo img {}
#phpinfo hr {}
</style>
<div id="phpinfo">
<?php
ob_start () ;
phpinfo () ;
$pinfo = ob_get_contents () ;
ob_end_clean () ;
hasta
abajo
9
Calin S. ¶
Hace 5 años
After reading and trying various functions, I couldn't find one that
correctly parses all the configurations, strips any left-over html
tag and converts special characters into UTF8 (e.g. ' into '),
so I created my own by improving on the existing ones:
function phpinfo2array() {
$entitiesToUtf8 = function($input) {
// http://php.net/manual/en/function.html-entity-
decode.php#104617
return preg_replace_callback("/(&#[0-9]+;)/", function($m)
{ return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); },
$input);
};
$plainText = function($input) use ($entitiesToUtf8) {
return
trim(html_entity_decode($entitiesToUtf8(strip_tags($input))));
};
$titlePlainText = function($input) use ($plainText) {
return '# '.$plainText($input);
};
ob_start();
phpinfo(-1);
$phpinfo = array('phpinfo' => array());
if(preg_match_all(
'#(?:<h2.*?>(?:<a.*?>)?(.*?)(?:<\/a>)?<\/h2>)|'.
'(?:<tr.*?><t[hd].*?>(.*?)\s*</t[hd]>(?:<t[hd].*?
>(.*?)\s*</t[hd]>(?:<t[hd].*?>(.*?)\s*</t[hd]>)?)?</tr>)#s',
$input,
$matches,
PREG_SET_ORDER
)) {
foreach ($matches as $match) {
$fn = strpos($match[0], '<th') === false ? $plainText :
$titlePlainText;
if (strlen($match[1])) {
$phpinfo[$match[1]] = array();
} elseif (isset($match[3])) {
$keys1 = array_keys($phpinfo);
$phpinfo[end($keys1)][$fn($match[2])] =
isset($match[4]) ? array($fn($match[3]), $fn($match[4])) :
$fn($match[3]);
} else {
$keys1 = array_keys($phpinfo);
$phpinfo[end($keys1)][] = $fn($match[2]);
}
}
}
return $phpinfo;
}
The output looks something like this (note the headers are also
included but are prefixed with '# ', e.g. '# Directive'):
Array
(
[phpinfo] => Array
(
[0] => PHP Version 5.6.5
[System] => Darwin Calins-MBP 15.0.0 Darwin Kernel
Version 15.0.0: Wed Aug 26 19:41:34 PDT 2015; root:xnu-
3247.1.106~5/RELEASE_X86_64 x86_64
[Build Date] => Feb 19 2015 18:34:18
[Registered Stream Socket Transports] => tcp, udp, unix,
udg, ssl, sslv3, sslv2, tls, tlsv1.0
[Registered Stream Filters] => zlib.*, bzip2.*,
convert.iconv.*, string.rot13, string.toupper, string.tolower,
string.strip_tags, convert.*, consumed, dechunk
[1] => This program makes use of the Zend Scripting
Language Engine:Zend Engine...
)
hasta
abajo
5
keinwort en hotmail punto com ¶
hace 3 años
REMARK/INFO: if Content-Security-Policy HTTP header
is
Content-Security-Policy "default-src 'self';";
hasta
abajo
4
Ken ¶
Hace 9 años
Hi.
<?php
function phpinfo_array()
{
ob_start();
phpinfo();
$info_arr = array();
$info_lines = explode("\n", strip_tags(ob_get_clean(), "<tr><td><h2>"
));
$cat = "General";
foreach($info_lines as $line)
{
// new cat?
preg_match("~<h2>(.*)</h2>~", $line, $title) ? $cat = $title[1] : nul
l;
if(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]
+>([^<]*)</td></tr>~", $line, $val))
{
$info_arr[$cat][$val[1]] = $val[2];
}
elseif(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]
+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val))
{
$info_arr[$cat][$val[1]] =
array("local" => $val[2], "master" => $val[3]);
}
}
return $info_arr;
}
// example:
echo "<pre>".print_r(phpinfo_array(), 1)."</pre>";
?>
hasta
abajo
3
SimonD ¶
Hace 8 años
Removes sensitive data like AUTH_USER and AUTH_PASSWORD from the
phpinfo output:
<?php
// start output buffering
ob_start();
echo $html;
hasta
abajo
2
arimbourg en ariworld dot eu ¶
Hace 10 años
This is necessary to obtain a W3C validation (XHTML1.0
Transitionnal)...
phpinfo's output is declared with that DTD :
- "System ID" has the wrong url to validate : "DTD/xhtml1-
transitional.dtd" rather than
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
- Some module names contains space and the function's output use the
name in anchors as ID and NAME. these attributes can't be validated
like that (unique name only).
<?php
ob_start ();
$imp = new DOMImplementation ();
$dtd = $imp->createDocumentType (
'html',
'-//W3C//DTD XHTML 1.0 Transitional//EN',
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'
);
$doc = $imp->createDocument (
'http://www.w3.org/1999/xhtml',
'html',
$dtd
);
$doc->encoding = 'utf-8';
$info_doc = new DOMDocument ('1.0', 'utf-8');
/* Parse phpinfo's output
* operator @ used to avoid messages about undefined entities
* or use loadHTML instead
*/
@$info_doc->loadXML ($info);
// Now you get a clean output and you are able to validate...
/*
echo ($doc->saveXML ());
// OR
echo ($doc->saveHTML ());
*/
// As you wish, take the rest of the output and add it for debugging
$out = ob_get_clean ();
$pre = $doc->createElement ('div'); // or pre
$pre->setAttribute ('style', 'white-space: pre;'); // for a div
element, useless with pre
$pre->appendChild ($doc->createTextNode ($out));
$body->appendChild ($pre);
?>
All that could be done with only RegExp but I prefer the use of DOM
for manipulating documents
hasta
abajo
2
código en adspeed dot com ¶
hace 15 años
This function parses the phpinfo output to get details about a PHP
module.
<?php
/** parse php modules from phpinfo */
function parsePHPModules() {
ob_start();
phpinfo(INFO_MODULES);
$s = ob_get_contents();
ob_end_clean();
$s = strip_tags($s,'<h2><th><td>');
$s = preg_replace('/<th[^>]*>([^<]+)<\/th>/',"<info>\\1</info>",$s);
$s = preg_replace('/<td[^>]*>([^<]+)<\/td>/',"<info>\\1</info>",$s);
$vTmp = preg_split('/(<h2>[^<]+<\/h2>)/',$s,-
1,PREG_SPLIT_DELIM_CAPTURE);
$vModules = array();
for ($i=1;$i<count($vTmp);$i++) {
if (preg_match('/<h2>([^<]+)<\/h2>/',$vTmp[$i],$vMat)) {
$vName = trim($vMat[1]);
$vTmp2 = explode("\n",$vTmp[$i+1]);
foreach ($vTmp2 AS $vOne) {
$vPat = '<info>([^<]+)<\/info>';
$vPat3 = "/$vPat\s*$vPat\s*$vPat/";
$vPat2 = "/$vPat\s*$vPat/";
if (preg_match($vPat3,$vOne,$vMat)) { // 3cols
$vModules[$vName][trim($vMat[1])] =
array(trim($vMat[2]),trim($vMat[3]));
} elseif (preg_match($vPat2,$vOne,$vMat)) { // 2cols
$vModules[$vName][trim($vMat[1])] = trim($vMat[2]);
}
}
}
}
return $vModules;
}
?>
Sample Output:
[gd] => Array
(
[GD Support] => enabled
[GD Version] => bundled (2.0.28 compatible)
[FreeType Support] => enabled
[FreeType Linkage] => with freetype
[FreeType Version] => 2.1.9
[T1Lib Support] => enabled
[GIF Read Support] => enabled
[GIF Create Support] => enabled
[JPG Support] => enabled
[PNG Support] => enabled
[WBMP Support] => enabled
[XBM Support] => enabled
)
<?php
/** get a module setting */
function getModuleSetting($pModuleName,$pSetting) {
$vModules = parsePHPModules();
return $vModules[$pModuleName][$pSetting];
}
?>
hasta
abajo
1
Joseph Reilly ¶
Hace 6 años
One note on the very useful example by "jon at sitewizard dot ca".
The following statements:
Statement 1:
$phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ?
array($match[3], $match[4]) : $match[3];
Statement 2:
$phpinfo[end(array_keys($phpinfo))][] = $match[2];
These two lines will produce the error "Strict Standards: Only
variables should be passed by reference in...". The root of the
error is in the incorrect use of the end() function. The code works
but thows the said error.
To address this try using the following statements:
Statement 1 revision:
$keys = array_keys($phpinfo);
$phpinfo[end($keys)][$match[2]] = isset($match[4]) ? array($match[3],
$match[4]) : $match[3];
Statement 2 revision:
$keys = array_keys($phpinfo);
$phpinfo[end($keys)][] = $match[2];
if(preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?
</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?
>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd]
(?: class=".*?")?>(.*?)\s*</t[hd]>)?)?
</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)){
foreach($matches as $match){
if(strlen($match[1])){
$phpinfo[$match[1]] = array();
}elseif(isset($match[3])){
$keys1 = array_keys($phpinfo);
$phpinfo[end($keys1)][$match[2]] = isset($match[4]) ?
array($match[3], $match[4]) : $match[3];
}else{
$keys1 = array_keys($phpinfo);
$phpinfo[end($keys1)][] = $match[2];
}
}
}
if(! empty($phpinfo)){
foreach($phpinfo as $name => $section) {
echo "<h3>$name</h3>\n<table class='wp-list-table widefat
fixed pages'>\n";
foreach($section as $key => $val){
if(is_array($val)){
echo "<tr><td>$key</td><td>$val[0]</td><td>$val[1]</td></tr>\n";
}elseif(is_string($key)){
echo "<tr><td>$key</td><td>$val</td></tr>\n";
}else{
echo "<tr><td>$val</td></tr>\n";
}
}
}
echo "</table>\n";
}else{
echo "<h3>Sorry, the phpinfo() function is not accessable.
Perhaps, it is disabled<a
href='http://php.net/manual/en/function.phpinfo.php'>See the
documentation.</a></h3>";
}
}
?>
Frankly, I went thought the trouble of adding this note because the
example by "jon at sitewizard dot ca" is probably the best on the
web, and thought it unfortunate that it throws errors. Hope this is
useful to someone.
hasta
abajo
1
jb2386 en hotmail dot com ¶
hace 14 años
This is a slight modification to the previous code by "code at
adspeed dot com" that extracts the PHP modules as an array. I used it
on PHP 4.1.2 and it failed as the <h2> tags also had an
align="center". So this update changes the regex for those tags:
<?php
function parsePHPModules() {
ob_start();
phpinfo(INFO_MODULES);
$s = ob_get_contents();
ob_end_clean();
$s = strip_tags($s,'<h2><th><td>');
$s = preg_replace('/<th[^>]*>([^<]+)<\/th>/',"<info>\\1</info>",$s);
$s = preg_replace('/<td[^>]*>([^<]+)<\/td>/',"<info>\\1</info>",$s);
$vTmp = preg_split('/(<h2[^>]*>[^<]+<\/h2>)/',$s,-
1,PREG_SPLIT_DELIM_CAPTURE);
$vModules = array();
for ($i=1;$i<count($vTmp);$i++) {
if (preg_match('/<h2[^>]*>([^<]+)<\/h2>/',$vTmp[$i],$vMat)) {
$vName = trim($vMat[1]);
$vTmp2 = explode("\n",$vTmp[$i+1]);
foreach ($vTmp2 AS $vOne) {
$vPat = '<info>([^<]+)<\/info>';
$vPat3 = "/$vPat\s*$vPat\s*$vPat/";
$vPat2 = "/$vPat\s*$vPat/";
if (preg_match($vPat3,$vOne,$vMat)) { // 3cols
$vModules[$vName][trim($vMat[1])] =
array(trim($vMat[2]),trim($vMat[3]));
} elseif (preg_match($vPat2,$vOne,$vMat)) { // 2cols
$vModules[$vName][trim($vMat[1])] = trim($vMat[2]);
}
}
}
}
return $vModules;
}
?>
hasta
abajo
0
cbar en vmait dot com ¶
hace 7 años
<?php
// I hope the coder will fix it, so as to save someone else from
wasting time. Otherwise, nice script.
?>
hasta
abajo
0
yurkins ¶
hace 13 años
big thanx 2 Mardy dot Hutchinson at gmail dot com
very good!
<?php
preg_match ('%<style type="text/css">(.*?)</style>.*?
(<body>.*</body>)%s', ob_get_clean(), $matches);
?>
to
<?php
preg_match ('%<style type="text/css">(.*?)</style>.*?
<body>(.*?)</body>%s', ob_get_clean(), $matches);
?>
and
<?php
preg_split( '/\n/', $matches[1] )
?>
to
<?php
preg_split( '/\n/', trim(preg_replace( "/\nbody/", "\n", $matches[1])
) )
?>
hasta
abajo
0
Andrew dot Boag en catalizador dot net dot nz ¶
hace 13 años
One note on the above functions for cleaning up the phpinfo() HTML
and throwing it into an array data structure. In order to catch all
of the info tidbits the preg_match_all has to be tweaked to deal with
2 and 3 column tables.
<?php
function parsePHPConfig() {
ob_start();
phpinfo(-1);
$s = ob_get_contents();
ob_end_clean();
$a = $mtc = array();
if (preg_match_all('/<tr><td class="e">(.*?)<\/td><td
class="v">(.*?)<\/td>(:?<td class="v">(.*?)<\/td>)?<\/tr>/',$s,
$mtc,PREG_SET_ORDER))
foreach($mtc as $v){
if($v[2] == '<i>no value</i>') continue;
$a[$v[1]] = $v[2];
}
}
return $a;
}
?>
hasta
abajo
-1
jon en sitewizard dot ca ¶
hace 13 años
To extract all of the data from phpinfo into a nested array:
<?php
ob_start();
phpinfo();
$phpinfo = array('phpinfo' => array());
if(preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|
(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?
>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd]
(?: class=".*?")?>(.*?)\s*</t[hd]>)?)?
</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER))
foreach($matches as $match)
if(strlen($match[1]))
$phpinfo[$match[1]] = array();
elseif(isset($match[3]))
$phpinfo[end(array_keys($phpinfo))][$match[2]] =
isset($match[4]) ? array($match[3], $match[4]) : $match[3];
else
$phpinfo[end(array_keys($phpinfo))][] = $match[2];
?>
<?php
echo "System: {$phpinfo['phpinfo']['System']}<br />\n";
echo "Safe Mode: {$phpinfo['PHP Core']['safe_mode'][0]}<br />\n";
echo "License: {$phpinfo['PHP License'][0]}<br />\n";
?>
To display everything:
<?php
foreach($phpinfo as $name => $section) {
echo "<h3>$name</h3>\n<table>\n";
foreach($section as $key => $val) {
if(is_array($val))
echo "<tr><td>$key</td><td>$val[0]</td><td>$val[1]</td></tr>\n";
elseif(is_string($key))
echo "<tr><td>$key</td><td>$val</td></tr>\n";
else
echo "<tr><td>$val</td></tr>\n";
}
echo "</table>\n";
}
?>
hasta
abajo
-1
Útil Harry ¶
hace 15 años
check out this cool and fantastic colourful phpinfo()!
<?php
ob_start();
phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
preg_match_all('/#[0-9a-fA-F]{6}/', $phpinfo, $rawmatches);
for ($i = 0; $i < count($rawmatches[0]); $i++)
$matches[] = $rawmatches[0][$i];
$matches = array_unique($matches);
$hexvalue = '0123456789abcdef';
$j = 0;
foreach ($matches as $match)
{
$r = '#';
$searches[$j] = $match;
for ($i = 0; $i < 6; $i++)
$r .= substr($hexvalue, mt_rand(0, 15), 1);
$replacements[$j++] = $r;
unset($r);
}
for ($i = 0; $i < count($searches); $i++)
$phpinfo = str_replace($searches, $replacements, $phpinfo);
echo $phpinfo;
?>
hasta
abajo
-3
Mardy dot Hutchinson en gmail dot com ¶
hace 13 años
Embedding phpinfo within your page, that already has style
information:
<?php
ob_start();
phpinfo();
preg_match ('%<style type="text/css">(.*?)</style>.*?
(<body>.*</body>)%s', ob_get_clean(), $matches);
hasta
abajo
-4
webmaster en askapache dot com ¶
Hace 12 años
I wanted a simple *function* to convert the output of phpinfo into an
array. Here's what I came up with thanks to alot of the previous
authors tips, and the source file: php-5.2.6/ext/standard/info.c
== Sample Output ==
[PHP Configuration] => Array
(
[PHP Version] => 5.2.6
[PHP Egg] => PHPE9568F34-D428-11d2-A769-00AA001ACF42
[System] => Linux askapache 2.6.22.19-grsec3
[Build Date] => Nov 11 2008 13:09:07
[Configure Command] => ./configure --prefix=/home/grsec/bin/php
[Server API] => FastCGI
<?php
function phpinfo_array($return=false){
/* Andale! Andale! Yee-Hah! */
ob_start();
phpinfo(-1);
$pi = preg_replace(
array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms',
'#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '#
+<#',
"#[ \t]+#", '# #', '# +#', '# class=".*?"#', '%'%',
'#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>'
.'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#',
'#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#',
'#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),
(?:.*?)</tr>#',
"# +#", '#<tr>#', '#</tr>#'),
array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ',
'<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP
Version</td><td>$2</td></tr>'.
"\n".'<tr><td>PHP Egg</td><td>$1</td></tr>',
'<tr><td>PHP Credits Egg</td><td>$1</td></tr>',
'<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" .
'<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'),
ob_get_clean());
$sections = explode('<h2>', strip_tags($pi, '<h2><th><td>'));
unset($sections[0]);
$pi = array();
foreach($sections as $section){
$n = substr($section, 0, strpos($section, '</h2>'));
preg_match_all(
'#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E
%#',
$section, $askapache, PREG_SET_ORDER);
foreach($askapache as $m)
$pi[$n][$m[1]]=(!isset($m[3])||$m[2]==$m[3])?
$m[2]:array_slice($m,2);
}
?>
hasta
abajo
-6
henzeberkheij en punto SPAM punto gmail punto com ¶
Hace 9 años
I needed a way to quickly scroll through the phpinfo which is a large
list of information. so here it is. In the top there is a list with
sections, the new section loaded extensions will hold the links to
the anchors of the loaded modules. the section session variables will
show the current loaded sessions. It's using Domdocument for
manipulation so you should have that loaded:
<?php
ob_start();
$exts = get_loaded_extensions();
phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
//print $phpinfo;
$html_str = $phpinfo;
$html = new DOMDocument();
$html->loadHTML($html_str);
$title = $html->getElementsByTagName("title")->item(0);
$title->nodeValue = "PHP Version ".phpversion();
$body = $html->getElementsByTagName("body")->item(0);
$body->setAttribute("style", "background-color:beige;");
$table = $body = $html->getElementsByTagName("table")->item(3)-
>nextSibling;
$head = $html->getElementsByTagName("table")->item(0)-
>nextSibling;
ob_start();
?>
<h2><a name="session_variables">Session variables</a></h2>
<table border="0" cellpadding="2" width="600">
<tr class="h"><th>Variables</th><th>Value</th></tr>
<?php foreach($_SESSION as $key=>$value){
if(is_bool($value)){
$value = ($value)?"true":"false";
}else if(is_array($value)){
$value = '<pre>'.print_r($value, true).'</pre>';
}else if(empty($value) && $value != "0"){
$value = "<i>no value</i>";
}
?>
<tr>
<td class="e"><?=$key?></td>
<td class="v"><?=$value?></td>
</tr>
<?php
}
?>
</table>
<h2><a name="loaded_extensions">loaded extensions</a></h2>
<table border="0" cellpadding="2" width="600">
<tr class="h"><th>Extension</th><th>Version</th></tr>
<?php
natcasesort($exts);
foreach($exts as $value){
$version = phpversion($value);
?>
<tr>
<td class="e" style="width:150px;"><a href="#module_<?
=$value?>" style="color:black; background-color:#ccccff;"><?=$value?
></a></td>
<td class="v"><?=(!empty($version))?
$version:"<i>Unknown</i>" ?></td>
</tr>
<?php
}
?>
</table><br />
<?php
$txt_str = ob_get_contents();
ob_end_clean();
$txt = new DOMDocument();
$txt->loadHTML($txt_str);
$txt_body = $txt->getElementsByTagName("body")->item(0);
foreach($txt_body->childNodes as $child){
$child = $html->importNode($child, true);
$table->parentNode->insertBefore($child, $table);
}
$h2 = $html->getElementsByTagName("h2");
foreach($h2 as $item){
if($item->getElementsByTagName("a")->length == 0){
$value = $item->nodeValue;
$item->nodeValue = "";
$a = $html->createElement("a");
$a->setAttribute("name", strtolower(str_replace("
", "_", $value)));
$a->nodeValue = $value;
$item->appendChild($a);
}
$a = $item->getElementsByTagName("a")->item(0);
if(!in_array($a->nodeValue, $exts)){
$menu[strtolower(str_replace(" ", "_", $a->nodeValue))]
= $a->nodeValue;
}
$top_a = $html->createElement("a");
if(!in_array($a->nodeValue, $exts)){
$txt = $html->createTextNode("(Go to top)");
$top_a->appendChild($txt);
$top_a->setAttribute("href", "#");
}else{
$txt = $html->createTextNode("(Go to extensionlist)");
$top_a->appendChild($txt);
$top_a->setAttribute("href", "#loaded_extensions");
}
$top_a->setAttribute("style", "background-color:beige; font-
size:12px; margin-left:5px; margin-top:-5px; color:black;");
$item->appendChild($top_a);
}
ob_start();
?>
<br />
<table border="0" cellpadding="2" width="600">
<tr class="h"><th colspan="2">Sections</th></tr>
<tr>
<?php
$i = 0;
foreach($menu as $key=>$item){
print "<td class='v'><a href='#$key' style='background-
color:#cccccc; color:black;'>$item</a></td>";
if($i%2){
print '</tr><tr>';
}
$i++;
}
if($i%2){
print '<td class="v"></td>';
}
?>
</tr>
</table>
<?php
$txt_str = ob_get_clean();
$txt = new DOMDocument();
$txt->loadHTML($txt_str);
$txt_body = $txt->getElementsByTagName("body")->item(0);
foreach($txt_body->childNodes as $child){
$child = $html->importNode($child, true);
$table->parentNode->insertBefore($child, $head);
}
print $html->saveHTML();
?>
hasta
abajo
-6
LewisR ¶
Hace 6 años
Building on SimonD's elegant example to hide the logged-in username
and password, which otherwise appear in plain text, the following
should work for PHP 5.4+:
<?php
// start output buffering
ob_start();
echo $html;
?>
hasta
abajo
-9
neo_selen ¶
Hace 9 años
here you can notice that these numeric values of phpinfo
are similar to certain things in the binary system:
unsigned,127 is:
111 1111
so, take a look at this: the way to get all function is to add all of
them. zero is nothing.-1 is all.
so you can pass option with a negative number.
for example:
<?php phpinfo(48) ?>
is also:
<?php phpinfo(-80) ?>
48 = 32 + 16
-80= 0 - 64 - 8 - 4 - 2 - 1
so, that's good if you don't want option 8, you will do this:
not nothing(0)
not all(-1)
not option 8(-1)
you got:
<?php phpinfo(-9); ?>
hasta
abajo
-12
bimal en sanjaal punto com ¶
hace 3 años
If you are embeding the output of the function within a page, the
<html> tag can collide and page will distort.
<?php
public function info()
{
ob_start();
phpinfo();
$info = ob_get_clean();
$info = preg_replace("/^.*?\<body\>/is", "", $info);
$info = preg_replace("/<\/body\>.*?$/is", "", $info);
echo $info;
}
?>