嗨我仍然不知道爲什麼這些代碼不起作用,他們還沒有產生任何錯誤,雖然我已經測試small example,它的工作。包括和功能不工作
下面是這些代碼: securedlogin.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();
}
?>
toggleFirePHP.php
<?php
require_once($_SERVER['Document_ROOT'].'/firephp_include.php');
$firephp->setEnabled(TRUE);
?>
main.php
<?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();
?>
那麼什麼地方出錯了這些代碼? 我們將非常感謝您的幫助。 克萊門特
你試過在你的兩個phps的開頭添加這個? - 「全球$ firephp;」 – Akshay
它是如何「不工作」?你得到什麼錯誤,或發生了什麼? –
'include()'中的'require()'?你知道這有什麼區別嗎? –