Hello, I'm new to PHP and would like to know how to create a class to manage the user session.
It would be a function to start the session and another to destroy the session.
If you have how to create, how could I be doing this?
Hello, I'm new to PHP and would like to know how to create a class to manage the user session.
It would be a function to start the session and another to destroy the session.
If you have how to create, how could I be doing this?
If I understand correctly, you want a class that has the function of starting and destroying a session, so here's a brief example
class Session {
public static function init() {
if(session_id() == '') {
session_start();
}
}
public static function destroy() {
session_destroy();
}
}