FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Printing out or displaying for debugging
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Printing out or displaying for debugging [message #179842 is a reply to message #179836] Tue, 11 December 2012 17:31 Go to previous messageGo to previous message
Shake is currently offline  Shake
Messages: 40
Registered: May 2012
Karma:
Member
There are lots of ways.

First:

use print_r
use var_dump

Check de manual for these useful tools.

Second:

To show info in screen:
- You can check the IP-
- You can check user logged of type Admin.
- You can pass (and check) some data by GET

An usefull way is (short and simple version):

Use a function with global var (or better static), something like

function DebugInfo($text, $bWeb = true) {
global $DebugInfoTxT;
$DebugInfoTxT .= "$text\n";
if($bWeb) $DebugInfoTxT .= '<br />';

}

You can call this function to "save" debug info.
<?php

if($something) {
DebugInfo('something is true');
}
DebugInfo("Value $something");

?>

And at the end, a function that "echoes" everything:

function showDebug() {
global $DebugInfoTxT;
//check here things, like UP, User, or some get... for example
if(isset($_GET['debug'])&&$_GET['debug']=='ejd7d7ehebd') {
echo "<div id='debug'>$DebugInfoTxT</div>\n";
}
}

With some CSS, and Some Javascript, you can make the "debug" DIV easy to
see, hide...

Encapsulate this in a Class...

regards
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script?
Next Topic: Re: Converting file from word.doc to pdf...
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 29 22:37:32 GMT 2024

Total time taken to generate the page: 0.04207 seconds