[請益] str_pad中英文混合時對不齊
最近遇到了一個問題,不知道有人有解決方案嗎?
我在用str_pad的時候裡面有中英文混合就沒辦法對的齊
原始碼如下
<?php
require_once "HTML/Template/IT.php";
$p_arr = array ("p_id" => "產品ID",
"p_board" => "產品品牌(外部Table)",
"p_model" => "產品型號",
"p_category" => "產品分類(外部Table)",
"p_warranty" => "產品保固",
"p_memo" => "產品備註",
);
$template = new HTML_Template_IT("./tpl");
$template->loadTemplatefile ("productFilePlaning.html", true, true);
$template->setCurrentBlock("CUSTOMER");
foreach ($p_arr as $key => $value)
{
$value_padding = $key.str_pad ($value, 90, ".", STR_PAD_LEFT);
$template->setVariable ("$key", $value_padding);
}
$template->parseCurrentBlock ();
$template->show ();
?>
麻煩各位了,謝謝。
補一下輸出的html原始碼
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
ul {font-family:Monaco}
</style>
<title></title>
</head>
<body>
<div id="header">
<h1>商品檔規劃書(SQL)</h1>
</div>
<div id="main">
<ul>
<!-- BEGIN product -->
<li>p_id................................產品ID</li>
<li>p_board...............產品品牌(外部Table)</li>
<li>p_model............................產品型號</li>
<li>p_category...............產品分類(外部Table)</li>
<li>p_warranty............................產品保固</li>
<li>p_memo............................產品備註</li>
<!-- BEGIN product -->
</ul>
</div>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.134.191.220
※ 編輯: darklady 來自: 220.134.191.220 (06/02 14:59)
→
06/02 14:59, , 1F
06/02 14:59, 1F
→
06/02 14:59, , 2F
06/02 14:59, 2F
→
06/02 15:00, , 3F
06/02 15:00, 3F
→
06/02 15:01, , 4F
06/02 15:01, 4F
→
06/02 15:01, , 5F
06/02 15:01, 5F
→
06/02 15:10, , 6F
06/02 15:10, 6F
※ 編輯: darklady 來自: 220.134.191.220 (06/02 15:15)
※ 編輯: darklady 來自: 220.134.191.220 (06/02 15:15)
※ 編輯: darklady 來自: 220.134.191.220 (06/02 15:19)
→
06/02 15:29, , 7F
06/02 15:29, 7F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章