我正在使用XmlHTTPRequest对象异步调用PHP脚本,但我在输出中得到var_dump
的返回值。
这是响应文本(我已经编辑了我的电子邮件):
array(5) {
["UID"]=>
string(1) "3"
["NAME"]=>
string(15) "Henry Kissenger"
["EMAIL"]=>
string(25) "******@*******.com"
["PASS"]=>
string(34) "$1$.nDZEZgZ$QKuE.mhlBPDZ3WdhwkiPC1"
["TITLE"]=>
string(9) "Exchequer"
}
3 | Exchequer | Henry Kissenger | ******@*******.com |
在PHP脚本和类中没有任何地方被调用,甚至进行了查找/替换以确保它不被调用。相关代码如下,在其中很多都找不到var_dump
。
getSingleUser.php
,由xhr obj调用
<?php
session_start();
$pathUser = __DIR__."/../user/uClass_v2.php";
require $pathUser;
$user = User::withID($_SESSION["UID"]);
echo "$user->ID | $user->title | $user->name | $user->email | ";
?>
uClass_v2.php
,相关功能。
//queries db for user with ID, then returns the instance.
public static function withID($ID)
{
$instance = new self();
$instance->loadByID($ID);
return $instance;
}
//queries the user table using the queryByUID() funct, then fill()s
public function loadByID($ID)
{
$result = $this->queryByUID($ID);
$this->fill($result);
}
//queries user table, returns the assoc array.
public function queryByUID($ID)
{
$this->CON = new mysqli("domain.name","kevin","******","tbd");
$query = "SELECT * FROM User WHERE UID =".$ID;
$results = $this->CON->query($query);
if($results->num_rows > 0)
{
return $results->fetch_assoc();
}
}
#accepts array, performs checks to ensure not empty or not meeting assoc array format required, then sets object properties.
public function fill(array $row)
{
//counts number of array elements, to decide if existing user or creating new user.
$noElements = count($row);
if($noElements <= 0 || $noElements > 5)
{
//return "incorrect # elements";
}else if($noElements == 4)
{
//registering new user, leave UID unset.
//not sure if isset checks are required.
if(isset($row["name"]) &&
isset($row["title"])&&
isset($row["email"])&&
isset($row["pass"]))
{
$this->name = $row["name"];
$this->title = $row["title"];
$this->email = $row["email"];
// @ below = shut up about salts php7
$this->pass = @crypt($row["pass"]);
}
else
{
//return "not all element set.";
}
}else if($noElements == 5)
{ //existing user, from db row.
$this->name = $row["NAME"];
$this->title = $row["TITLE"];
$this->email = $row["EMAIL"];
$this->ID = $row["UID"];
$this->pass = $row["PASS"];
}else
{
//echo "I don't think you should ever see this";
}
}
这只是在我的廉价托管服务转移到我自己的服务器之后才发生的。这是我的Apache / php.ini
中的错误配置吗?
如果这看起来很熟悉,请告诉我,我对此感到非常沮丧!
答案 0 :(得分:0)
它不再这样做,这是我所做的改变。
在start_session上禁止警告,没有修复
@session_start();
评论出每一个回声,然后取消评论它们似乎解决了这个问题,但我不能为我的生活找到原因。 //echo "someString";
- &GT; echo "someString";
几次重新启动httpd,没有更改httpd.conf或php.ini
如果有人能够解释这一点,我会永远感激。