duanba8173 2017-10-30 19:38
浏览 10
已采纳

错误,PHP中意外的T_IF错误? [重复]

This question already has an answer here:

Parse error: syntax error, unexpected T_IF in update.php on line 90

I really dont see any problem in my code, why this is happening, please help.

<?= Html::activeHiddenInput($model, 'organization_title') ?>


    <?= $form->field($model, 'reason') ?>

90 line!    <?= if ($model->move_type === 1) { ?>
        <div id="partial-cost">
        <?=  $this->render('_cost-fields', [
            'model' => $model,
            'sourceType' => $sourceType,
            'typeDropdown' => $typeDropdown,
            'targetDropdown' => $targetDropdown,
            'form' => $form
            ]) ?>
        </div>
    <?= } ?>

    <?= if ($model->move_type === 0) { ?>
        <div id="partial-income" >
        <?= $this->render('_income-fields', [
            'model' => $model,
            'sourceType' => $sourceType,
            'typeDropdown' => $typeDropdown,
            'targetDropdown' => $targetDropdown,
            'form' => $form
            ]) ?>
        </div>  
    <?= } ?>



    <div class="form-group">
        <button type="submit" class="btn btn-default">Save</button>
    </div>
</div>
  • 写回答

1条回答 默认 最新

  • dshakcsq64956 2017-10-30 19:40
    关注

    <?= is a shorthand for <?php echo - you can't echo an if-statement.

    This also applies to your lines reading <?= } ?>.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器