我正在尝试回复 div ,但我收到了以下错误:
Notice: Undefined index: count on $SESSION['count']
当触发$ SESSION ['error']时,我收到以下错误:
Undefined index: count on $SESSION['error']
当触发$ SESSION ['count']时,我收到与上面类似的错误。
以下是PHP中的代码。
<?php
if(isset($_SESSION['error'])){
} else {
foreach($_SESSION['search_output'] as $value){
$value['links'];
$value['title'];
$value['page_body'];
$title = $value['title'];
$link = $value['links'];
$body = $value['page_body'];
$search_output .= "<a href='".$link."'>".$title."</a> - $body<br><br>";}
}
?>
<div id="topResult">
<?php echo $_SESSION['error']; unset($_SESSION['error']);?>
<?php echo ($_SESSION['count']); unset($_SESSION['count']);?>
</div>
<div id="searchBox"><?php echo $search_output; ?></div>
我不能像$search_output
变量那样回应结果吗?
答案 0 :(得分:0)
使用
<?php if(isset($_SESSION['error'])) {echo $_SESSION['error']; unset($_SESSION['error']);} ?>
<?php if(isset($_SESSION['count'])) {echo ($_SESSION['count']); unset($_SESSION['count']);} ?>