PHP会话变量存在,但PHP消息:PHP注意:
我得到了这个错误:PHP会话变量存在,但PHP消息:PHP注意:,php,session,Php,Session,我得到了这个错误: [17-Oct-2014 08:46:12] WARNING: [pool blah.com] child 43657 said into stderr: "NOTICE: PHP message: PHP Notice: Undefined index: database_geo in /var/blah/site_profile.class.php on line 124" 错误是针对以下代码的,我将var_dump()与会话var放在它前面: print '<
[17-Oct-2014 08:46:12] WARNING: [pool blah.com] child 43657 said into stderr:
"NOTICE: PHP message: PHP Notice: Undefined index: database_geo in /var/blah/site_profile.class.php on line 124"
错误是针对以下代码的,我将var_dump()与会话var放在它前面:
print '<pre>';
var_dump($_SESSION['database_geo']);
print '</pre>';
// GEO Distance between Members in KM or Miles
if($this-true) {
$sql='SELECT la,b FROM geoWorld WHERE pid=? LIMIT 1;';
$pds=$database->pdo->prepare($sql); $pds->execute(array($_SESSION['database_geo'])); $row=$pds->fetch();
$this->geoDistanceToMe = $location->geoDistanceBetweenMembers($this->profileLatitude,$this->profileLongitude,$row['latitude'],$row['longitude'],FALSE);
}
打印“”;
var_dump($_会话['database_geo']);
打印“”;
//构件之间的地理距离(以公里或英里为单位)
如果($这是真的){
$sql='从geoWorld中选择la,b,其中pid=?限制1;';
$pds=$database->pdo->prepare($sql);$pds->execute(数组($\u SESSION['database\u geo']);$row=$pds->fetch();
$this->geoDistanceToMe=$location->geodistancebetween成员($this->profileLatitude,$this->profileLongitude,$row['latitude',$row['longitude',FALSE);
}
页面显示良好,但显示错误。
我可以看到变量“$\u SESSION['database\u geo']”在var\u dump()中显示时存在
是否有任何原因导致该消息出现在var存在的情况下
谢谢-困惑…在进入
$\u会话或从$\u会话获取内容之前,请使用会话启动()
。
查看此链接上述片段是否完整?var\u dump
和if子句之间还有其他行吗?此处可能还有一个不相关的语法错误$this true
。请使用if($this true){
更正错误,然后重试代码。