嗨我仍然无法弄清楚为什么这些代码不起作用,虽然我已经测试了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();
?>
这些代码出了什么问题? 我们将非常感谢您的帮助。 克莱门特
答案 0 :(得分:0)
如果先/
,则包含来自根FS的文件
使用
include_once './../toggleFirePHP.php';
和
include_once 'toggleFirePHP.php'; //ok
答案 1 :(得分:0)