有的时候我们得在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');
?>
注意:路径一定要正确
原文地址:https://blog.csdn.net/tangxiujiang
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。