Eigenes PHP Info
Erstellt am 16.11.2009 um 15:05 Uhr von sim4000
Diese kleine Anleitung beschreibt, wie man sich ein selbst gestaltetes phpinfo erstellen kann.
Dazu werden die Funktionen ob_start(), ob_get_contents() und ob_end_clean() verwendet. Die Ausgabe von phpinfo() wird also gecached und in eine Variable geschrieben.
Danach wird noch alles vor <body> und alles nach </body> weggeschnitten, damit man den Code in eine eigene PHP Datei einfügen kann kann.
PHP Code
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ob_start(); phpinfo(); $info = ob_get_contents(); ob_end_clean(); $info = substr($info, strpos($info, "<body>")+6); $info = substr($info, 0, strpos($info, "</body>")); echo "<div class='phpinfo'>"; $search = array(" />", ","); $replace = array(">", ", "); echo str_replace($search, $replace, $info); echo "</div>"; |
Der phpinfo Source wird noch HTML 4.1 Konform gemacht. Möchte man dies nicht, muss man halt das str_replace() dementsprechend anpassen.
Stylesheets
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | div.phpinfo pre { margin: 0px; font-family: monospace; } div.phpinfo a, div.phpinfo a:link, div.phpinfo a:active, div.phpinfo a:visited { text-decoration: none; color:#E18401!important; } div.phpinfo a:hover { text-decoration: underline; color:#E18401!important; } div.phpinfo table { border-collapse: collapse; } div.phpinfo .center { text-align: center; } div.phpinfo .center table { margin-left: auto; margin-right: auto; text-align: left; } div.phpinfo .center th { text-align: center !important; } div.phpinfo td, div.phpinfo th { border: 1px solid #000000; vertical-align: baseline; } div.phpinfo h1 { color:#E18401; } div.phpinfo h2 { color:#E18401; border:0px none; } div.phpinfo .p { text-align: left; } div.phpinfo .e { background-color: #FFC267; font-weight: bold; color: #000000;} div.phpinfo .h { font-weight: bold; color: #000000; border:0px none; background-color:#FFC267;} div.phpinfo .h h1 { color:black; } div.phpinfo .v { background-color: transparent; color: #000000; } div.phpinfo .vr { background-color: transparent; text-align: right; color: #000000; } div.phpinfo img { float: right; border: 0px; } div.phpinfo hr { width: 600px; background-color: transparent; border: 0px; height: 1px; color: #000000; } |




