douyue1998 2012-11-05 13:34
浏览 19

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

I am writing a rather large PHP application and I've come to a point where I would like some debugging output. I've successfully installed FireBug and FirePHP and I've managed to output one line of text to the console.

Here is the problem now. I have a php file called Register.php which contains basically code only to display the view and submit the form. This file calls a function in the SiteViewModel.php class to do the actually background work in registering the user. The SiteViewModel.php also calls other php files to connect to the DB and perform checks/inserts.

If I put the debugging line in the SiteViewModel.php file constructor I get an output to the Firebug console. If I put any other lines anywhere else I get nothing logged.

Some code

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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据