本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\SessionInterface::all方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionInterface::all方法的具体用法?PHP SessionInterface::all怎么用?PHP SessionInterface::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Session\SessionInterface
的用法示例。
在下文中一共展示了SessionInterface::all方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
/**
* {@inheritdoc}
*/
public function collect()
{
$request = $this->request;
$response = $this->response;
$responseHeaders = $response->headers->all();
$cookies = array();
foreach ($response->headers->getCookies() as $cookie) {
$cookies[] = $this->getCookieHeader($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
}
if (count($cookies) > 0) {
$responseHeaders['Set-Cookie'] = $cookies;
}
$statusCode = $response->getStatusCode();
$data = array('format' => $request->getRequestFormat(), 'content_type' => $response->headers->get('Content-Type') ? $response->headers->get('Content-Type') : 'text/html', 'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '', 'status_code' => $statusCode, 'request_query' => $request->query->all(), 'request_request' => $request->request->all(), 'request_headers' => $request->headers->all(), 'request_server' => $request->server->all(), 'request_cookies' => $request->cookies->all(), 'response_headers' => $responseHeaders, 'path_info' => $request->getPathInfo());
if ($this->session) {
$sessionAttributes = array();
foreach ($this->session->all() as $key => $value) {
$sessionAttributes[$key] = $value;
}
$data['session_attributes'] = $sessionAttributes;
}
if (isset($data['request_headers']['php-auth-pw'])) {
$data['request_headers']['php-auth-pw'] = '******';
}
if (isset($data['request_server']['PHP_AUTH_PW'])) {
$data['request_server']['PHP_AUTH_PW'] = '******';
}
foreach ($data as $key => $var) {
if (!is_string($data[$key])) {
$data[$key] = $this->formatVar($var);
}
}
return $data;
}
示例2: collect
/**
* {@inheritdoc}
*/
public function collect()
{
$data = array();
foreach ($this->session->all() as $key => $value) {
$data[$key] = is_string($value) ? $value : $this->formatVar($value);
}
return $data;
}
示例3: collect
/**
* {@inheritdoc}
*/
public function collect()
{
$request = $this->request;
$response = $this->response;
$data = array('getData' => $request->query->all(), 'postData' => $request->request->all(), 'headers' => $request->headers->all(), 'cookies' => $request->cookies->all(), 'uri' => $request->getRequestUri(), 'method' => $request->getMethod(), 'responseStatus' => $response->getStatusCode());
if ($this->session) {
$sessionAttributes = array();
foreach ($this->session->all() as $key => $value) {
$sessionAttributes[$key] = $value;
}
$data['sessionData'] = $sessionAttributes;
}
if (isset($data['postData']['php-auth-pw'])) {
$data['postData']['php-auth-pw'] = '******';
}
if (isset($data['postData']['PHP_AUTH_PW'])) {
$data['postData']['PHP_AUTH_PW'] = '******';
}
return $data;
}
示例4: postRequestHandle
/**
* @param SessionInterface $session
* @param Response $response
*/
private function postRequestHandle(SessionInterface $session, Response $response)
{
if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) {
$id = $session->getId();
$key = 'session:' . $id;
$content = $session->all();
unset($content['_token'], $content['flash']);
$lastSeen = time();
$content['last_seen'] = $lastSeen;
$session->set('last_seen', $lastSeen);
$value = Json::dump($content);
$this->redis->watch($key);
$this->redis->multi();
$this->redis->set($key, $value);
$this->redis->expire($key, $this->getSessionLifetimeInSeconds());
$this->redis->exec();
$cookie = new Cookie($this->key, $id, $this->getCookieExpirationDate(), $config['path'], $config['domain'], Arr::get($config, 'secure', false));
$response->headers->setCookie($cookie);
}
}
示例5: testInvalidate
public function testInvalidate()
{
$this->session->set('invalidate', 123);
$this->session->invalidate();
$this->assertEquals(array(), $this->session->all());
}
示例6: __invoke
public function __invoke(array $record)
{
$record['extra']['session'] = $this->session->all();
return $record;
}
示例7: logSession
/**
* Session のログを出力する.
*/
protected function logSession(SessionInterface $Session)
{
return $this->logArray($Session->all(), '[session]');
}
示例8: removeValues
/**
* Removes from the session all the key-value pairs whose key has the specified prefix.
*
* @param string $prefix
* @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session
*/
private function removeValues($prefix, SessionInterface $session)
{
foreach ($session->all() as $key => $value) {
if (0 === strpos($key, $prefix)) {
$session->remove($key);
}
}
}
示例9: all_userdata
/**
* Fetch all session data
*
* @return array
*/
public function all_userdata()
{
return $this->session->all();
}
示例10: all
/**
* Gets the service container parameters.
*
* @return array An array of parameters
*
* @api
*/
public function all()
{
return $this->session->all();
}