Yii Captcha图像没有显示在我的网络托管上

时间:2014-07-17 21:37:27

标签: php yii captcha

我在localhost中有一个Yii Web项目。该网站在localhost中运行良好,但在网络托管中没有显示yii验证码图像。

我的SiteController:

public function accessRules()
    {
        return array(
            array('allow',  // allow all users to perform 'index' and 'view' actions
                // need to allow captcha in order to view it.
                'actions'=>array('create','view','index','captcha'),
                'users'=>array('*'),
            ),
            );
    }
public function actions(){
        return array(
        // captcha action renders the CAPTCHA image displayed on the contact page
            'captcha'=>array(
            'class'=>'CCaptchaAction',
            'backColor'=>0xFFFFFF,
            ),
}

我的ContactForm模型:

public $verifyCode;
public function rules()
    {
        return array(
            // name, email, subject and body are required
            array('name, email, subject, body', 'required'),
            // email has to be a valid email address
            array('email', 'email'),
            // verifyCode needs to be entered correctly
            array('verifyCode', 'captcha', 'allowEmpty' => !extension_loaded('gd')),
            );
    }

我的联络视图:

  <?php if(extension_loaded('gd')): ?>
        <div class="span4">
            <?php echo $form->labelEx($model,'verifyCode'); ?>
            <?php echo $form->textField($model,'verifyCode'); ?>
            <div>
                <?php $this->widget('CCaptcha'); ?>
            </div>
            <div class="hint">Please enter the letters as they are shown in the image above.
            <br/>Letters are not case-sensitive.</div>
        </div>
    <?php endif; ?>

我的托管: 图书馆GD

GD Support  enabled
GD Version  bundled (2.1.0 compatible)
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.4.2
T1Lib Support   enabled
GIF Read Support    enabled
GIF Create Support  enabled
JPEG Support    enabled
libJPEG Version 6b
PNG Support enabled
libPNG Version  1.2.44
WBMP Support    enabled
XPM Support enabled
libXpm Version  30411
XBM Support enabled
Directive   Local Value Master Value
gd.jpeg_ignore_warning  0   0

我的本​​地主机服务器:

gd
GD Support  enabled
GD Version  bundled (2.0.34 compatible)
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.4.11
T1Lib Support   enabled
GIF Read Support    enabled
GIF Create Support  enabled
JPEG Support    enabled
libJPEG Version 9
PNG Support enabled
libPNG Version  1.5.14
WBMP Support    enabled
XPM Support enabled
libXpm Version  30411
XBM Support enabled

Directive   Local Value Master Value
gd.jpeg_ignore_warning  0   0

我的.php文件是UTF8,没有BLOM 不明白为什么它不起作用:(

0 个答案:

没有答案