具有多个类和依赖项的Firephp日志记录

时间:2012-11-05 13:34:49

标签: php firephp

我正在编写一个相当大的PHP应用程序,我已经到了一个需要调试输出的地步。我已经成功安装了FireBug和FirePHP,并且我已经设法将一行文本输出到控制台。

现在是问题所在。我有一个名为Register.php的php文件,它基本上只包含显示视图和提交表单的代码。此文件调用SiteViewModel.php类中的函数来执行注册用户的实际后台工作。 SiteViewModel.php还调用其他php文件连接到数据库并执行检查/插入。

如果我将调试行放在SiteViewModel.php文件构造函数中,我会得到一个输出到Firebug控制台。如果我把任何其他行放在其他任何地方,我什么都没记录。

一些代码

Register.php:

<?php
require_once("/xampp/htdocs/SiteConfig.php");

if(isset($_POST['submitted']))
{
   if($rlrpgSite->RegisterUser())
   {
        $rlrpgSite->RedirectToURL("registrationthanks.php");
   }
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
    <title>Register</title>
    <link rel="STYLESHEET" type="text/css" href="../style/fg_membersite.css" />
    <script type='text/javascript' src='../scripts/gen_validatorv31.js'></script>
    <link rel="STYLESHEET" type="text/css" href="../style/pwdwidget.css" />
    <script src="../scripts/pwdwidget.js" type="text/javascript"></script>      
</head>
<body>

<!-- Form Code Start -->
<div id='fg_membersite'>
<form id='register' action='<?php echo $rlrpgSite->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'>
<fieldset >
<legend>Register</legend>

<input type='hidden' name='submitted' id='submitted' value='1'/>

<div class='short_explanation'>* required fields</div>
<input type='text'  class='spmhidip' name='<?php echo $rlrpgSite->GetSpamTrapInputName(); ?>' />

<div><span class='error'><?php echo $rlrpgSite->GetErrorMessage(); ?></span></div>
<div class='container'>
    <label for='firstname' >First Name*: </label><br/>
    <input type='text' name='FirstName' id='FirstName' value='<?php echo $rlrpgSite->SafeDisplay('FirstName') ?>' maxlength="100" /><br/>
    <span id='register_firstname_errorloc' class='error'></span>
</div>
<div class='container'>
    <label for='lastname' >Last Name*: </label><br/>
    <input type='text' name='LastName' id='LastName' value='<?php echo $rlrpgSite->SafeDisplay('LastName') ?>' maxlength="100" /><br/>
    <span id='register_lastname_errorloc' class='error'></span>
</div>
<div class='container'>
    <label for='email' >Email Address*:</label><br/>
    <input type='text' name='EmailAddress' id='EmailAddress' value='<?php echo $rlrpgSite->SafeDisplay('EmailAddress') ?>' maxlength="512" /><br/>
    <span id='register_email_errorloc' class='error'></span>
</div>
<div class='container'>
    <label for='username' >UserName*:</label><br/>
    <input type='text' name='UserName' id='UserName' value='<?php echo $rlrpgSite->SafeDisplay('UserName') ?>' maxlength="255" /><br/>
    <span id='register_username_errorloc' class='error'></span>
</div>
<div class='container' style='height:80px;'>
    <label for='Password' >Password*:</label><br/>
    <div class='pwdwidgetdiv' id='thepwddiv' ></div>
    <noscript>
    <input type='password' name='Password' id='Password' maxlength="50" />
    </noscript>    
    <div id='register_password_errorloc' class='error' style='clear:both'></div>
</div>

<div class='container'>
    <input type='submit' name='Submit' value='Submit' />
</div>

</fieldset>
</form>
<!-- client-side Form Validations:
Uses the excellent form validation script from JavaScript-coder.com-->

<script type='text/javascript'>
// <![CDATA[
    var pwdwidget = new PasswordWidget('thepwddiv','Password');
    pwdwidget.MakePWDWidget();

    var frmvalidator  = new Validator("register");
    frmvalidator.EnableOnPageErrorDisplay();
    frmvalidator.EnableMsgsTogether();
    frmvalidator.addValidation("firstname","req","Please provide your name");

    frmvalidator.addValidation("lastname","req","Please provide your name");

    frmvalidator.addValidation("email","req","Please provide your email address");

    frmvalidator.addValidation("email","email","Please provide a valid email address");

    frmvalidator.addValidation("username","req","Please provide a username");

    frmvalidator.addValidation("Password","req","Please provide a password");

// ]]>
</script>

<!--
Form Code End (see html-form-guide.com for more info.)
-->

</body>
</html>

SiteConfig.php:

<?php
require_once('SiteViewModel.php');

$rlrpgSite = new siteviewmodel();

$rlrpgSite->SetWebsiteName('localhost.com');

$rlrpgSite->SetAdminEmail('rlrpg@localhost.com');

$rlrpgSite->SetRandomKey('Hng2XxIdNfp8EwO');
?>

SiteViewModel.php:

<?php
class siteviewmodel
{
...
function siteviewmodel()
    {
        ob_start();
        fb("Instantiating");
        //This works
    }

RegistUser()
    {
        ob_start();
        fb("Registering");
        //doesn't work
    }
}
?>

0 个答案:

没有答案