在php文件里面插入文件html

有的时候我们得在php文件里面引入html代码,或者在php文件的某个位置引入文件html,下面就介绍一下实现的方法。


下面是recharge.php的代码:

<?php
  require_once "../../config.php";
?>
<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<title>充值</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<link rel="stylesheet" href="../common/css/header.css" />
	<link rel="stylesheet" href="css/recharge.css">
  <link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet" />
  <script src="http://i.gtimg.cn/qzone/biz/gdt/lib/jquery/jquery-2.1.4.js?max_age=31536000"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
  <script src="../common/js/common.js"></script>
  <script src="../config.js"></script>
  <script src="js/recharge.js"></script>
</head>

<body>
  <script type="text/javascript">
    var serviceChargePoint = <?php echo $redbag_cash_in_point;?>;
  </script>
	<!-- 引入公共模块:只有logo的导航条 -->
  <?php
    include_once('../common/header2.html');
  ?>

  <div class="rechargeDiv">
  	<h2>充值到账户</h2>
  	<p>当前账户余额:<span class="balance" id="balance">0.00</span>元</p>
  	<input type="text" name="data" class="rechargeInput" placeholder="请输入充值数额(元)" id="rechargeInput" οnkeyup="calculatePoundage()">
  	<p class="poundage">手续费<span class="poundageMoney" id="poundageMoney" name="result">0.00</span>元(手续费=充值金额*<?php echo $redbag_cash_in_point;?>%)</p>
  	<p>需支付:<span class="pay" id="pay">0.00</span>元</p>
  	<span class="example">例如:您充值22元,则共需支付22+22*<?php echo $redbag_cash_in_point;?>%=24.2元</span>
  	<button type="button" class="rechargeBtn" id="rechargeBtn">充值</button>
  </div>
</body>
</html>
我们可以在php文件里面直接写html的标签,用来显示页面的。

也可以在<body></body>标签的任意位置引入文件html,如下面的形式:

  <?php
    include_once('../common/header2.html');
  ?>
注意:路径一定要正确

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值