johnny1991

johnny1991

xxxxxxxxxxxxxxxxxxxxx

  • 财富值3285
  • 威望值580
  • 总积分9895

个人信息

  • 回复了 的回答

    这个要看你的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',
            ],
    

    没有这个目录会在这个类初始化的时候自动创建这个目录,如果实在不行,你可以手动创建这个目录,源码参照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);
            }
        }
    
  • 回复了 的回答

    这个要看你的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',
            ],
    

    filecache会自动创建这个文件夹

  • 2017-10-24 已签到
    连续签到1天,获得了5个金钱
  • 回复了 的回答

    这个要看你的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',
            ],
    

    默认存放在 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',
            ],
    
  • 回答了问题 dropDownList()

    从错误信息上可以知道,你的$form应该是null

  • 2017-10-18 已签到
    连续签到1天,获得了5个金钱
    • validate 是根据rules的规则,验证你的数据是否符合规则,如果不符合规则的,就会通过addError来添加error
    • 添加了error的model,调用hasError就会返回true,调用getErrors()就会返回错误信息
  • 2017-10-16 已签到
    连续签到1天,获得了5个金钱
  • 赞了回答

    兄弟你可以先写,遇到问题再问

副总裁 等级规则
9895/10000
资料完整度
60/100
用户活跃度
0/100

Ta的关注

19

Ta的粉丝

26

Ta的访客

81