我有这段代码:
<?php
session_start();
$cislonak=$_GET['cislonakupu'];
$_SESSION['cislonakupu'] = $cislonak;
$sessionnakupu = $_SESSION['cislonakupu'];
echo $sessionnakupu;
?>
会话仅适用于以下网站:shoppingcart.php?cislonakupu = 123456789 ......
在index.php上它不起作用。 问题在哪里?
答案 0 :(得分:0)
试试这个:
<?php
session_start();
if(isset($_GET['cislonakupu'])) {
$cislonak = $_GET['cislonakupu'];
$_SESSION['cislonakupu'] = $cislonak;
}
if(isset($_SESSION['cislonakupu'])) {
$sessionnakupu = $_SESSION['cislonakupu'];
echo $sessionnakupu;
}
?>