嗨,我仍然不能弄清楚为什么这些代码不工作,他们没有产生任何错误,虽然我已经测试了这个小例子,它工作。
代码如下: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();
?>
那么这些代码出了什么问题呢?非常感谢您的帮助。克莱门特
如果/
优先,则包含来自根FS的文件
include_once './../toggleFirePHP.php';
和
include_once 'toggleFirePHP.php'; //ok
参见链接和链接
- 正确的securedlogin.php是'/toggleFirePHP.php'。
- 正确的toggleFirePhp.php是'firephp_include.php'.
- 正确的main.php是'toggleFirePHP.php'和"/安全/securedlogin.php"
root的文件系统如下所示:-
Root folder
toggleFirePHP.php
main.php
alertmessage.php
firephp_include.php
secured folder
securedlogin.php