2020-04-30 12:22:45 1529次浏览 0条回答 0 悬赏 50 金钱

<figcaption> 标签中内容长度 >=293 字节 并且 $form->field() 数量 >=3 时页面底部会报错

An Error occurred while handling another error:
yii\web\HeadersAlreadySentException: Headers already sent in E:\phptest\demo\vendor\yiisoft\yii2\web\View.php on line 182. in E:\phptest\demo\vendor\yiisoft\yii2\web\Response.php:366
Stack trace:
#0 E:\phptest\demo\vendor\yiisoft\yii2\web\Response.php(339): yii\web\Response->sendHeaders()
#1 E:\phptest\demo\vendor\yiisoft\yii2\web\ErrorHandler.php(136): yii\web\Response->send()
#2 E:\phptest\demo\vendor\yiisoft\yii2\base\ErrorHandler.php(123): yii\web\ErrorHandler->renderException(Object(yii\web\HeadersAlreadySentException))
#3 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\HeadersAlreadySentException))
#4 {main}
Previous exception:
yii\web\HeadersAlreadySentException: Headers already sent in E:\phptest\demo\vendor\yiisoft\yii2\web\View.php on line 182. in E:\phptest\demo\vendor\yiisoft\yii2\web\Response.php:366
Stack trace:
#0 E:\phptest\demo\vendor\yiisoft\yii2\web\Response.php(339): yii\web\Response->sendHeaders()
#1 E:\phptest\demo\vendor\yiisoft\yii2\base\Application.php(392): yii\web\Response->send()
#2 E:\phptest\demo\web\index.php(12): yii\base\Application->run()
#3 {main}

测试了 windows linux 下都有这个问题,php 版本 5.6 及以上

源代码

<?php

use yii\bootstrap4\Html;
use yii\bootstrap4\ActiveForm;
?>
<div class="container">
        <div class="article-content">
            <figure class="image">
                <img src="/uploads/common/202004/1588213377EOZtNh.jpg">
                <figcaption>00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</figcaption>
            </figure>
        </div>
</div>
<div class="container">
    <hr>
    <div class="feedback-form">
        <h3>留言</h3>
        <?php $form = ActiveForm::begin(['method'=>'post']); ?>
        <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
        <?= $form->field($model, 'telephone')->textInput(['maxlength' => true]) ?>
        <?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
        <div class="form-group">
            <?= Html::submitButton('提交留言', ['class' => 'btn btn-success btn-block']) ?>
        </div>
        <?php ActiveForm::end(); ?>
    </div>
</div>
    没有找到数据。
您需要登录后才可以回答。登录 | 立即注册
qingchen
副总裁

qingchen

注册时间:2013-09-09
最后登录:2024-10-24
在线时长:35小时37分
  • 粉丝5
  • 金钱4280
  • 威望60
  • 积分5230

热门问题