[英]CakePHP Email Component
Any reason why when I include the Email component in my controller without writing any code for it: 为什么在我的控制器中包含Email组件而不为其编写任何代码的任何原因:
var $components = array('Email');
I get a fatal error saying: 我收到一个致命错误,说:
Fatal error: Call to a member function read() on a non-object
I assume this is relating to the $Session variable, when I comment the component out, the error disappears. 我认为这与$ Session变量有关,当我注释掉组件时,错误消失了。
似乎Session组件默认情况下已加载,但是如果我在AppController中定义var $ components = array('Email')且不将Session包含在数组中,则会将其删除。
After your comments I suggest you write var $components = array('Email', 'Session')
, this should get you rid of your error. 在您发表评论之后,我建议您编写
var $components = array('Email', 'Session')
,这应该使您摆脱错误。 The problem is, that the AppController components don't get merged with the defaults. 问题在于,AppController组件不会与默认值合并。 That means, if you declare the components with just 'Email', your Session-component will be lost and you therefore get this error because $this->Session is not an object.
这意味着,如果仅使用“ Email”声明组件,则Session组件将丢失,因此您会收到此错误,因为$ this-> Session不是对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.