为什么SessionComponent :: write()在配合的计算机上工作,但不在我的计算机上?

Sas*_*las 1 cakephp

它与PHP或Apache配置有什么关系吗?

错误信息:

Non-static method SessionComponent::write() should not be called statically, assuming $this from incompatible context [APP\View\Households\add.ctp, line 64]

第64行: SessionComponent::write('ChildCounter', -1);

mar*_*ark 7

SessionComponent::write() should not be called statically
Run Code Online (Sandbox Code Playgroud)

那你为什么这么做?:)

要么按照记录正确使用它:

$this->Session->write()
Run Code Online (Sandbox Code Playgroud)

当然,在正确的范围(控制器/组件)内.

或使用静态CakeSession访问:

CakeSession::write()
Run Code Online (Sandbox Code Playgroud)

你的APP中的任何其他地方.