-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathexample.php
More file actions
71 lines (62 loc) · 1.62 KB
/
example.php
File metadata and controls
71 lines (62 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MoneyConvertor Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body {
font-size: 14px;
font-family: Cambria, "Tahoma", "SimSun";
}
table {
border-collapse: collapse;
border-spacing: 0;
margin-bottom: 20px;
}
table th, table td {
padding: 8px;
line-height: 20px;
text-align: left;
vertical-align: top;
border: 1px solid #DDD;
}
</style>
</head>
<body>
<table style="min-width: 600px">
<thead>
<tr>
<th style="text-align:left">编号</th>
<th style="text-align:left">小写货币</th>
<th style="text-align:left">大写货币</th>
</tr>
</thead>
<tbody>
<?php
ini_set("display_errors", "on");
require __DIR__ . '/MoneyConvertor.php';
$money = array(
'1.5',
'50000',
65001.05,
101010101011.01,
'1,999,999,999',
'.5',
'1000.00',
'a.22'
);
$moneyObj = new MoneyConvertor();
$output = '';
foreach ($money as $key => $value) {
$output .= "<tr>";
$output .= "<td style=\"text-align:left\">" . ($key + 1) . "</td>";
$output .= "<td style=\"text-align:left\">¥ " . $value . "</td>";
$output .= "<td style=\"text-align:left\"><em style='font-style:normal;margin-right:7px;'>人民币(大写)</em> " . $moneyObj->convert($value) . "</td>";
$output .= "</tr>";
}
echo $output;
?>
</tbody>
</table>
</body>
</html>