2016-10-06 94 views
0

我包括「success.php」到「create.php」,但對「create.php」越來越自動評論(HTML標籤)HTML自動轉換的PHP代碼爲評論

創建我的PHP代碼.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>

頁:

enter image description here

HTML代碼生成:

enter image description here

回答

1

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

需要有正確的開放標籤<?php同樣與<? } ?>應該<?php } ?>

+0

omg它的工作..我敢肯定,我測試........................ –

+0

偉大的,很高興它的工作。設置帖子解決,如果你的開心,有一個美好的一天 – Blinkydamo

+0

@AdrianoBacha:不要忘了標記爲已接受,如果它的工作 – devpro