性感的农民

性感的农民

有个性,不签名

  • 财富值7680
  • 威望值285
  • 总积分11410

个人信息

  • 试试在CCaptchaAction.php的renderImageGD($code)的末尾部分,输出图像之前,加ob_clean()清空输出缓冲区:

    protected function renderImageGD($code)
    {
             。。。。。。  //省略xxx行
    	imagecolordeallocate($image,$foreColor);
    	ob_clean();  // <================================ 情况输出缓冲区
    	header('Pragma: public');
    	header('Expires: 0');
    	header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    	header('Content-Transfer-Encoding: binary');
    	header("Content-Type: image/png");
    	imagepng($image);
    	imagedestroy($image);
    }
    
  • 2015-04-01 已签到
    连续签到12天,获得了20个金钱
  • 2015-03-31 已签到
    连续签到11天,获得了20个金钱
  • 2015-03-30 已签到
    连续签到10天,获得了20个金钱
  • 2015-03-29 已签到
    连续签到9天,获得了20个金钱
  • 2015-03-28 已签到
    连续签到8天,获得了20个金钱
  • yii2中实测OK:

    'urlManager' => [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [
            '' => 'site/index',
            '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
            'app/index/sta/<sta:\d+>' => 'app/index',   //  <==== 加这句规则
    
        ],
    ],
    

    http://.../app/index/sta/106 (末尾有/的写法自己改一下规则)
    在site/index中用如下语句可以取到sta参数:
    echo \Yii::$app->request->get('sta');

    yii2和yii1,$config['components']['urlManager']['rules']应该长一样的。

  • 2015-03-27 已签到
    连续签到7天,获得了20个金钱
    1. db.php其实被frontend/config/main.php或者frontend/config/main-local.php的require之后,也相当于是写在frontend/config/main.php或者是main-local.php中。

    2. common/config里面的配置是console,backend,frontend共用的,所以里面只放三者都适用的配置信息。比如你在frontend中用到module,则最好只在frontend/config中定义它,你要是在common里面的modules定义该module,你会发现执行console的command时会报错的,费力纠正这个错误是没有必要的,因为你不会在command中使用这个module。

    只要看三者的入口函数就清楚了:
    a) console的看yii

    $config = yii\helpers\ArrayHelper::merge(
        require(__DIR__ . '/common/config/main.php'),
        require(__DIR__ . '/common/config/main-local.php'),
        require(__DIR__ . '/console/config/main.php'),
        require(__DIR__ . '/console/config/main-local.php')
    );
    

    b) frontend的看frontend/web/index.php

    $config = yii\helpers\ArrayHelper::merge(
    	require __DIR__ . '/../../common/config/main.php',
    	require __DIR__ . '/../../common/config/main-local.php',
    	require __DIR__ . '/../config/main.php',
    	require __DIR__ . '/../config/main-local.php'
    );
    

    c) backend的看backend/web/index.php

    $config = yii\helpers\ArrayHelper::merge(
        require(__DIR__ . '/../../common/config/main.php'),
        require(__DIR__ . '/../../common/config/main-local.php'),
        require(__DIR__ . '/../config/main.php'),
        require(__DIR__ . '/../config/main-local.php')
    );
    

    merge的好处是,除了可以合并配置信息,后面的定义还会覆盖前面相同key的定义,比如main.php中对应的db是生产环境的db配置,而main-local.php对应的db是自己开发环境的db配置,那么main-local.php会覆盖掉main.php的db配置(main-local.php放在后面),比较适合多人协同开发的环境。(顺便说一下:main-local.php一般是不放到git仓库或者svn仓库的)

  • 2015-03-26 已签到
    连续签到6天,获得了20个金钱
11410/20000
资料完整度
60/100
用户活跃度
0/100

Ta的关注

29

Ta的粉丝

49

Ta的访客

106