我有一点问题,login.php
注册myusername和mypassword ..并重定向到index.php?bolum=panel
(控制面板)
的login.php:
session_start();
$_SESSION['myusername'] = $myusername;
$_SESSION['mypassword'] = $mypassword;
if(session_is_registered(myusername))
{
echo "<script> window.location.replace('index.php?bolum=panel') </script>";
}
和控制面板=&gt; panel.php
<?php session_start(); ?>
Username: <?php echo $_SESSION['myusername']; ?> <br/>
Password: <?php echo $_SESSION['mypassword']; ?>
为什么它不起作用,我无法在panel.php
中设置myusername和mypassword。
答案 0 :(得分:0)
session_start
。这包括在开始<?php
之前的空格字符。删除它们。此外,对于开发,请激活错误报告:
<?php
ini_set('display_errors', 'on');
error_reporting(-1);
答案 1 :(得分:0)
首先 - login.php
:
<?php
session_start();
$_SESSION['myusername'] = $myusername;
$_SESSION['mypassword'] = $mypassword;
if(isset($_SESSION['myusername'])){
header('Location: index.php?bolum=panel');
}
?>
你是如何从 index.php?bolum = panel 到 panel.php 的?