S2OJ/uoj/1/app/models/Session.php

19 lines
342 B
PHP
Raw Permalink Normal View History

2016-11-17 02:08:31 +00:00
<?php
class Session {
public static function init() {
session_name('UOJSESSID');
ini_set('session.cookie_path', '/');
ini_set('session.cookie_domain', UOJContext::cookieDomain());
session_start();
register_shutdown_function(function() {
if (empty($_SESSION)) {
session_unset();
session_destroy();
}
});
}
}