[英]I'm facing this error when trying to setup my wordpress on my local machine, but failed with error
I'm trying to setup a copy of my wordpress in my local server, the wordpress was customised with nodeJS and some other vendor's packages.我正在尝试在我的本地服务器中设置我的 wordpress 的副本,wordpress 是使用 nodeJS 和其他一些供应商的软件包定制的。 when setup and trying to run the wordpress, i received this error:
设置并尝试运行 wordpress 时,我收到此错误:
Error: The configuration for the "log" component must contain a "__class" element.错误:“log”组件的配置必须包含“__class”元素。
Which i think something related to Yii2 framework, i have changed the version from 2.0.6 to 2.0.14 in the composer.json file, but no luck.我认为与 Yii2 框架有关,我已将 composer.json 文件中的版本从 2.0.6 更改为 2.0.14,但没有运气。 Anyone can help?
任何人都可以帮忙吗?
Server is ubuntu server 18.04, running nginx and mysql, with PHP 7.2.服务器是 ubuntu 服务器 18.04,运行 nginx 和 mysql,带有 Z2FEC3923224A5C23AC138 DA。
From this issue, You need to modify the log key like this 从这个问题,您需要像这样修改日志键
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
'class' => 'yii\log\Logger',
],
EDITS : The error you are receiving now, has something to do with TimeStamp. 编辑 :您现在收到的错误与TimeStamp有关。 So, from this answer,
那么,从这个答案来看,
You have to declare it in the behaviors method of your model.
您必须在模型的behavior方法中声明它。 To use TimestampBehavior, insert the following code to your ActiveRecord class
若要使用TimestampBehavior,请将以下代码插入ActiveRecord类
public function behaviors()
{
return [
'class' => TimestampBehavior::className(),
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['create_time', 'update_time'],
ActiveRecord::EVENT_BEFORE_UPDATE => ['update_time'],
],];
}
This is inside one of my model 这是我的一个模型
use yii\behaviors\TimestampBehavior;
...
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['createDate','lastModifiedDate'],
ActiveRecord::EVENT_BEFORE_UPDATE => ['lastModifiedDate','shownOn'],
],
'value'=>function() {
return current_time('Y-m-d H:i:s');
}
],
];
}
...
...
I'm still receiving that TimestampBehavior error. 我仍然收到TimestampBehavior错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.