本文整理匯總了PHP中session::start_session方法的典型用法代碼示例。如果您正苦於以下問題:PHP session::start_session方法的具體用法?PHP session::start_session怎麽用?PHP session::start_session使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類session
的用法示例。
在下文中一共展示了session::start_session方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: is_logged_in
}
} catch (InvalidArgumentException $e) {
return false;
}
}
function is_logged_in()
{
if (isset($_SESSION['user_id'], $_SESSION['username'], $_SESSION['login_string'])) {
$user_id = $_SESSION['user_id'];
$login_string = $_SESSION['login_string'];
// Get the user-agent string of the user.
$user_browser = $_SERVER['HTTP_USER_AGENT'];
$dbManager = new DbSessionManager();
$user = $dbManager->get_user_by_id($user_id);
if ($user) {
$login_check = hash('sha512', $user->getPassword() . $user_browser);
if ($login_check == $login_string) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
$session = new session();
$session->start_session("s_");
示例2: substr
#############################################################
ob_start();
// Get install folder
include_once "install_folder.php";
// Set session duration.
$expire_time = 60 * 30;
// seconds * minutes
include "debug.php";
if (!isset($_SERVER['DOCUMENT_ROOT'])) {
$path = $_SERVER['DOCUMENT_ROOT'] = str_replace('\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0 - strlen($_SERVER['PHP_SELF'])));
} else {
$path = $_SERVER['DOCUMENT_ROOT'];
}
$path = $path . '/' . $install_directory_name;
// Include DB connection.
include_once $path . '/API/database.php';
// Include session data.
if (isset($control_panel_session)) {
include_once $path . '/API/session.class_affiliates.php';
} else {
include_once $path . '/API/session.class.php';
}
// Include sanitation functions.
if (!isset($exclude_validation)) {
include_once $path . '/includes/validation_functions.php';
}
// Activate session.
$session = new session();
$session->start_session("_s", false);
// Include global data.
include $path . '/API/data.php';
示例3: sec_session_start
function sec_session_start()
{
require 'session.class.php';
$session = new session();
$session->start_session('_s', SECURE);
}
示例4: session
<?php
require 'session.class.php';
$session = new session();
$session->start_session('_s', false);
$_SESSION['something'] = 'A value.';
echo $_SESSION['something'];