Ben bir işlevi ayarladıktan sonra başka bir sayfada bir oturumu erişmek istiyor. Ben fonksiyon içinde echo çünkü ben oturum ayarlanmış olduğunu görebilirsiniz. Sonra ben o oturuma erişmek istiyorsanız başka bir sayfaya kullanıcıyı gönderebilirsiniz. Sorun ben iletilir olduğumda oturum boş olmasıdır. Bu yüzden kimse bana söyleyebilir misiniz?
<?php
session_start();
function test($val){
session_destroy();
if(isset($val)){
$_SESSION['test'] = $val;
echo $_SESSION['test']; // echos 'test'
header("location: two.php");
}
}
test('test');
?>
<?php
// two.php
session_start();
echo $_SESSION['test']; // errors undefined index 'test'
?>