嗨我想开始一个用户会话,但我无法做到这一点。我也看到了它的例子,但我的问题仍然是一样的。我收到此错误
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a2277283/public_html/scripts/login.php on line 11
这是我的代码
<?php
ob_start();
session_start();
include 'db.php';
if (isset($_POST['submit'])) {
echo $email = $_POST['user_email'];
$sql = "select * from user where `user_email` = '$email'";
if (mysql_query($sql)) {
$_SESSION['email'] = $email;
echo "$_SESSION['email']";
}
}
?>
答案 0 :(得分:1)
echo "$_SESSION['email']";
不使用引号,如:
echo $_SESSION['email'];
或
echo "$_SESSION[email]";
或
echo "{$_SESSION['email']}";
答案 1 :(得分:0)
echo "{$_SESSION['email']}";