johnny1991
- johnny1991 回复了 johnny1991 的回答
这个要看你的cache是怎么配置的,查看config,比如存在redis里面
// redis cache 'cache' => [ 'class' => 'yii\redis\Cache', 'redis' => 'redis' ], // db cache 'dbCache' => [ 'class' => 'yii\caching\DbCache', 'cacheTable'=>'dts_cache', ], // file cache 'fileCache' => [ 'class' => 'yii\caching\FileCache', ],
@Allener 没有这个目录会在这个类初始化的时候自动创建这个目录,如果实在不行,你可以手动创建这个目录,源码参照yii\caching\FileCache
public function init() { parent::init(); $this->cachePath = Yii::getAlias($this->cachePath); if (!is_dir($this->cachePath)) { FileHelper::createDirectory($this->cachePath, $this->dirMode, true); } }
- johnny1991 回复了 johnny1991 的回答
这个要看你的cache是怎么配置的,查看config,比如存在redis里面
// redis cache 'cache' => [ 'class' => 'yii\redis\Cache', 'redis' => 'redis' ], // db cache 'dbCache' => [ 'class' => 'yii\caching\DbCache', 'cacheTable'=>'dts_cache', ], // file cache 'fileCache' => [ 'class' => 'yii\caching\FileCache', ],
@Allener filecache会自动创建这个文件夹
- johnny1991 2017-10-24 已签到连续签到1天,获得了5个金钱
- johnny1991 回复了 johnny1991 的回答
这个要看你的cache是怎么配置的,查看config,比如存在redis里面
// redis cache 'cache' => [ 'class' => 'yii\redis\Cache', 'redis' => 'redis' ], // db cache 'dbCache' => [ 'class' => 'yii\caching\DbCache', 'cacheTable'=>'dts_cache', ], // file cache 'fileCache' => [ 'class' => 'yii\caching\FileCache', ],
@Allener 默认存放在
public $cachePath = '@runtime/cache';
这个路径下面,具体什么文件下面,参照源码yii\caching\FileCache
// 这个$key就是你缓存的key protected function getCacheFile($key) { if ($this->directoryLevel > 0) { $base = $this->cachePath; for ($i = 0; $i < $this->directoryLevel; ++$i) { if (($prefix = substr($key, $i + $i, 2)) !== false) { $base .= DIRECTORY_SEPARATOR . $prefix; } } return $base . DIRECTORY_SEPARATOR . $key . $this->cacheFileSuffix; } else { return $this->cachePath . DIRECTORY_SEPARATOR . $key . $this->cacheFileSuffix; } }
这个要看你的cache是怎么配置的,查看config,比如存在redis里面
// redis cache 'cache' => [ 'class' => 'yii\redis\Cache', 'redis' => 'redis' ], // db cache 'dbCache' => [ 'class' => 'yii\caching\DbCache', 'cacheTable'=>'dts_cache', ], // file cache 'fileCache' => [ 'class' => 'yii\caching\FileCache', ],
- johnny1991 回答了问题 dropDownList()
从错误信息上可以知道,你的$form应该是null
- johnny1991 2017-10-18 已签到连续签到1天,获得了5个金钱
- validate 是根据rules的规则,验证你的数据是否符合规则,如果不符合规则的,就会通过addError来添加error
- 添加了error的model,调用hasError就会返回true,调用getErrors()就会返回错误信息
- johnny1991 2017-10-16 已签到连续签到1天,获得了5个金钱
- johnny1991 赞了回答
兄弟你可以先写,遇到问题再问