duangonglian6028 2016-10-06 14:11
浏览 53
已采纳

HTML自动将php标记转换为注释

I'm including 'success.php' into 'create.php' but my php code on 'create.php' is getting auto-commented (html tag)

create.php

<html>
        <head>
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
                <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
                <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
        </head>
        <body>
                <?php
                require("header.php");

                $amount = str_replace(array(".", ","), "", $_POST["amount"]);

                $data = array(
                                "amount"          => $amount,
                                "payment_method"  => $_POST["payment_method"],
                                "customer"        => $_POST["customer"],
                                "installments"    => $_POST["installments"]);

                if ($data["payment_method"] == "credit_card") {
                        $data += $_POST["card"];
                }


                try {
                        $transaction = new PagarMe_Transaction($data);
                        $transaction->charge();
                        require("success.php");
                } catch(Exception $e) {
                        echo $e->getMessage();
                }

                ?>
        </body>
</html>

success.php

<div class="container" style="padding-bottom:100px">
        <div class="page-header">
                <h1>Guide Life</h1>
        </div>
        <div class="alert alert-success" role="alert">
                <b>Transação efetuada com sucesso!</b>
        </div>
        <? if ($transaction->payment_method == "boleto") { ?>
                <p>
                        Link para o boleto:
                        <a target="_blank" href=""></a>
                        <iframe src="https://api.pagar.me/1/boletos/live_citxbiz9d0kg9gu3e33cwmdwr" width="100%" height="100%" />
                </p>
        <? } ?>
</div>

Page:

enter image description here

Html code generated:

enter image description here

</div>
  • 写回答

1条回答 默认 最新

  • dpgua04022 2016-10-06 14:13
    关注

    <? if ($transaction->payment_method == "boleto") { ?>

    Needs to have the correct open tag <?php same with <? } ?> should be <?php } ?>

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

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?