【问题标题】:how to modify captcha image source in yii?如何在 yii 中修改验证码图像源?
【发布时间】:2023-11-26 07:26:02
【问题描述】:

我的验证码图片没有显示,这是它的网址:

mysite.com/index.php/site/captcha?v=53b56139cb358,当我试图打开它时,我得到一个

错误:

Cannot modify header information - headers already sent by (output started at /home/patrahr/public_html/index.php:1)

功能操作:

public function actions()
    {
        return array(
            // captcha action renders the CAPTCHA image displayed on the contact page
            'captcha'=>array(
                'class'=>'CCaptchaAction',
                'backColor'=>0xFFFFFF,
            ),
            // page action renders "static" pages stored under 'protected/views/site/pages'
            // They can be accessed via: index.php?r=site/page&view=FileName
            'page'=>array(
                'class'=>'CViewAction',
            ),
        );
    }

那么我该如何解决这个错误呢?

【问题讨论】:

  • 其余的错误是什么?你也可以在你的 SiteController 中发布public function actions() 方法吗?
  • 您的索引页或配置文件中是否有echo
  • @deacs 没有,没有任何回声
  • PHP开始标签前空一行怎么样?

标签: php yii captcha


【解决方案1】:

当此问题快速发生时,您可以在没有 BOM 的情况下将段落转换为 UTF-8!

使用 Notepad ++ 执行此过程。

【讨论】: