0

<?php

namespace Utils;

use SymfonyComponentDependencyInjectionContainerInterface;

class Sessions
{

private $container;
private $session;

public function __construct(ContainerInterface $container)
{
    $this->container = $container;
    $this->session = $this->container->get('session');
}

在控制器使用$this->get('utils.sessions');提示
Attempted to load class "Sessions" from namespace "Utils".
Did you forget a "use" statement for another namespace?
命名空间具体怎么弄,放在Bundle中申明就没有这个错误,还是命名空间的问题,具体还没找到解决方案

撰写答案

SegmentFault

一起探索更多未知

下载 App