我的注销文件在我的本地主机上运行,但当我尝试在我的iPage主机帐户上使用它时,它会保存会话。我通过在登录重定向到的页面上打印会话变量来测试它。
我的logout.php文件的代码是:
<?php
session_start();
session_destroy();
header("Location: index.php");
?>
有任何帮助吗?谢谢
答案 0 :(得分:0)
使用class MainViewModel
{
private static readonly Random Random = new Random();
public MainViewModel()
{
var list = new List<string>();
for (int i = 0; i < 2000; i++)
{
list.Add(RandomString(8));
}
CollectionView =
CollectionViewSource.GetDefaultView(list.OrderBy(x => x[0]).Select(x => new TestItem {Value = x}));
CollectionView.GroupDescriptions.Add(new PropertyGroupDescription("Value", new FirstLetterConverter()));
}
public ICollectionView CollectionView { get; set; }
public static string RandomString(int length)
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[Random.Next(s.Length)]).ToArray());
}
}
public class TestItem
{
public string Value { get; set; }
}
public class FirstLetterConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string s = value as string;
if (!string.IsNullOrEmpty(s))
return s.Substring(0, 1);
return string.Empty;
}
public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
后,$ _SESSION中的值可能仍然可用,但它们不会在下一页加载时显示。
session_destroy();