我正在使用 Synfony 4 开发一个网站并创建了一个管理员登录。我使用了序列化和反序列化。
/**
* @inheritDoc
*/
public function serialize()
{
// TODO: Implement serialize() method.
return serialize([
$this->id,
$this->username,
$this->password
]);
}
/**
* @inheritDoc
*/
public function unserialize($serialized)
{
// TODO: Implement unserialize() method.
list(
$this->id,
$this->username,
$this->password
) = $this->unserialize($serialized, ["allowed_classes" => false]);
}
最后$this->unserialize($serialized, ["allowed_classes" => false]);不起作用并显示“方法调用提供了 2 个参数,但方法签名使用 1 个参数”作为 Intellij IDEA 中的错误。我不明白这意味着什么,也找不到任何关于它的信息。
我认为基本方法只是想要unserialize($serialized)或类似的东西,但是当我填写表格并发送它时,什么也没有发生。
呼唤远方