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

时间:2016-10-06 14:11:46

标签: php html include

我包括' success.php'进入' create.php'但我的PHP代码在' create.php'正在获得自动评论(html标签)

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>
&#13;
&#13;
&#13;

success.php

&#13;
&#13;
<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>
&#13;
&#13;
&#13;

页:

enter image description here

生成的Html代码:

enter image description here

1 个答案:

答案 0 :(得分:1)

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

需要<?php<? } ?>相同的正确开放标记<?php } ?>