文章来源:http://blog.youkuaiyun.com/qq_26656329/article/details/78733583
这是一个抽象接口,是php7.0新增的,然而官方没有这个接口的说明。
但是源码里面的确是有这个接口
https://github.com/php/php-src/blob/PHP-7.0.25/ext/session/session.c#L2616-L2623
SessionUpdateTimestampHandlerInterface
static const zend_function_entry php_session_update_timestamp_iface_functions[] = {
PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, validateId, arginfo_session_class_validateId)
PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, updateTimestamp, arginfo_session_class_updateTimestamp)
{ NULL, NULL, NULL }
};
这个接口只有两个方法
validateId:检查session会话id是否存在
当手动设置id的话这个方法还是有用的,
public function validateId(string $key) : bool;
updateTimestamp:更新session时间戳
public function updateTimestamp(string $key, string $val) : bool;
<?php
interface SessionUpdateTimestampHandlerInterface
{
/**
* Checks if a session identifier already exists or not.
*
* @param string $key
*
* @return bool
*/
public function validateId($key);
/**
* Updates the timestamp of a session when its data didn't change.
*
* @param string $key
* @param string $val
*
* @return bool
*/
public function updateTimestamp($key, $val);
}
参考例子
一个鲜为人知的接口!!!!!