嗨,我仍然无法弄清楚为什么这些代码不起作用并且它们没有产生任何错误,尽管我已经测试了这个小例子并且它起作用了。
以下是这些代码:securelogin.php
<?php
include_once '/../toggleFirePHP.php'; //ok
// Start here...................................................................
function connect($database)
{
$firephp->group("In securedlogin.php, debugging begins");
$firephp->info("Info: Building parameters before login and use database");
/*** mysql hostname ***/
$hostname = 'localhost';
/*** mysql username ***/
$username = 'root';
/*** mysql password ***/
$password = '';
/*** mysql database ***/
$firephp->log("Log: hostname=".$hostname.", username=".$username.", password=".$password.", database=".$database);
try {
$dbh = new PDO("mysql:host=$hostname;dbname=$database", $username, $password);
echo 'Connected to '.$database.' database'."<br/>";
$firephp->warn("Warn: Login and connected to $database database is successful!");
}
catch(PDOException $e)
{
$shorterr = $e->getMessage();
$alertmsg = $shorterr;
include 'alertmessage.php';
echo $shorterr."<br/>";
$firephp->error("Error: Login and connected to database is NOT successful! See below:");
$firephp->error("Error: $shorterr");
}
$firephp->groupEnd();
}
?>
切换FirePHP.php
<?php
require_once($_SERVER['Document_ROOT'].'/firephp_include.php');
$firephp->setEnabled(TRUE);
?>
主文件
<?php
include_once '/toggleFirePHP.php'; //ok
// Start here...................................................................
include_once 'secured/securedlogin.php';
$firephp->group("In main.php, debugging begins");
$database = 'testdata1970_05';
$firephp->log("Log: Include securedlogin.php once and use $database");
connect($database);
$firephp->groupEnd();
?>
那么这些代码出了什么问题呢?您的帮助将不胜感激。克莱门特