Precisando fazer debug em PHP de estrutura de dados?
Use a função abaixo:
<?php
function d($str){
if(!defined(‘debug’)) return false;
$style = “text-align:left;margin:1em;padding:1em;border:1px solid red;font-color:blue;”;
$style.= “background-color:#ffffff;font-size:12px;overflow:scroll;height:220px;”;
print ‘<pre style=”‘.$style.’”>’;
print_r($str);
print ‘</pre>’;
if(defined(‘debug_str’)){
print ‘<pre style=”‘.$style.’;background-color:#FF0084;color:#fff;height:120px;”>’;
print constant(‘debug_str’);
print ‘</pre>’;
}
print ‘<pre style=”‘.$style.’;background-color:#ffff00;height:120px;”>’;
debug_print_backtrace();
print ‘</pre>’;
print ‘<pre style=”‘.$style.’;background-color:green;color:white;”>’;
print_r($_GET);
print ‘</pre>’;
exit;
}
?>
Atenção com a primeira linha, se a constante debug não estiver definida não será exibido valor algum. Assim, se você estiver fazendo modificação [...]
-
Páginas
-
Categorias
-
Arquivos