本文整理汇总了PHP中Stream::session方法的典型用法代码示例。如果您正苦于以下问题:PHP Stream::session方法的具体用法?PHP Stream::session怎么用?PHP Stream::session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stream
的用法示例。
在下文中一共展示了Stream::session方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_session
public static function get_session()
{
if (!self::$session) {
// Generate the session ID. This is slightly wasteful.
$data = array();
$data['type'] = 'stream';
// This shouldn't be done here but at backend endpoint side
if (isset($_REQUEST['client'])) {
$data['agent'] = $_REQUEST['client'];
}
// Copy session geolocation
// Same thing, should be done elsewhere
$sid = session_id();
if ($sid) {
$location = Session::get_geolocation($sid);
if (isset($location['latitude'])) {
$data['geo_latitude'] = $location['latitude'];
}
if (isset($location['longitude'])) {
$data['geo_longitude'] = $location['longitude'];
}
if (isset($location['name'])) {
$data['geo_name'] = $location['name'];
}
}
self::$session = Session::create($data);
}
return self::$session;
}
示例2: _auto_init
/**
* auto_init
* This is called on class load it sets the session
*/
public static function _auto_init()
{
// Generate the session ID. This is slightly wasteful.
$data = array();
$data['type'] = 'stream';
if (isset($_REQUEST['client'])) {
$data['agent'] = $_REQUEST['client'];
}
self::$session = Session::create($data);
}