Iamはセッション値$_SESSION['LinkID']
を取得しようとしているが、何もそこにありません。.. openpages.phpでセッション値を取得できません
<?php
session_start();
if(!isset($_SESSION['login_user'])){
header("location: ../index.php");
}
?>
<div id="Wrapper">
<div id="Banner">
<div id="Logo">
<img src="../images/banner.png" width="200" height="60" alt=""/>
</div>
<div id="Navigation">
<?php include ("../cmd/funct/createlink.php");?>
<?php $_SESSION['LinkID'] = GenerateLinkID();?>
<?php include ("../modules/menu/menu.php");?> <!-- $_SESSION['LinkID'] Not Empty -->
</div>
</div>
<div id="oContent">
<?php echo $_SESSION['LinkID']?> <!-- $_SESSION['LinkID'] Not Empty -->
<?php include ("../cmd/funct/openpages.php");?> <!-- $_SESSION['LinkID'] EMPTY -->
<?php echo "<br>".$_SESSION['LinkID']?> <!-- $_SESSION['LinkID'] Not Empty -->
</div>
</div>
(付属私はopenpages.phpでsession_start()
を追加する場合
<?php
echo $_SESSION['LinkID']; //$_SESSION['LinkID'] Not Empty
if (empty($_GET[$_SESSION['LinkID']])) {
echo 'EMPTY';
} else {
echo 'NOT EMPTY';
$oXo = htmlspecialchars($_GET[$_SESSION['LinkID']]);
if ($oXo==EncryptLinkKey('encrypt', 'home')){
include ("statistic.php");
} elseif ($oXo==EncryptLinkKey('encrypt', 'sin')) {
include ("mailing/in/index.php");
} elseif ($oXo==EncryptLinkKey('encrypt', 'sout')) {
include ("mailing/out/index.php");
} elseif ($oXo==EncryptLinkKey('encrypt', 'srep')) {
include ("mailing/report/index.php");
} elseif ($oXo==EncryptLinkKey('encrypt', 'slogout')) {
include ("../logout.php");
header("location: ../index.php");
}
}
?>
)main.phpでは、通知を表示します
セッションがすでに開始されていた - のsession_start()
と
いただきました!間違ったopenpages.phpで常に "EMPTY" の結果を無視して...私は何かが足りないのですか?両方のファイルの最上部に
'$ _SESSION ['LinkID']'と呼ばれるクエリー・ストリング・パラメータ - これはケースですか?ちなみに – RamRaider
、あなたは出力バッファリングを使用していない限り、あなたはHTMLコンテンツを出力し始めているので、 'openpages.php' – RamRaider
@RamRaiderでヘッダーを設定するときは、おそらくエラーになるだろう、私はちょうど' $ _SESSION [「LINKID」]の値を取得したいです'空であれば何も表示せず、空でなければ別のページを開く(インクルードする)。私は 'elseif'状態になることはありません。 – CrazyThink