โดย 4404 » 22/04/2006 12:16 pm
สำหรับ php มีผล เกี่ยวกับการแสดง ภาษาไทย
ลองดูนี่ช่วย
PHP function สำหรับ WAP ข้อความภาษาไทย
อาจเป็นประโยชน์กับเพื่อนๆ ที่มีปัญหา ภาษาไทย ใน WAP ครับ
<?php
header("Content-type: text/vnd.wap.wml");
include("WapTools.class.php");
$wap = new WapTools();
?>
<wml>
<card id="card1" title="WAP Thai Demo">
<p>
<?php $wap->printthai("1. การคาดหวังของลูกค้าในงานบริการ"); ?><br/>
<?php $wap->printthai("2. ส่วนประสมทางการตลาด - ผลิตภัณฑ์ และราคา"); ?><br/>
<?php $wap->printthai("3. ส่วนประสมทางการตลาด - ช่องทางการจัดจำหน่ายและการ ส่งเสริมการตลาด"); ?><br/>
<?php $wap->printthai("4. ส่วนประสมทางการตลาดอื่น ๆ - บุคคล กระบวนการ และลักษณะทางกายภาพ"); ?><br/>
<?php $wap->printthai("5. กลยุทธ์ปกป้องตลาด, กลยุทธ์การเติบโต"); ?><br/>
</p>
</card>
</wml>
<?php
/**
WapTools.class.php
Copyright (C) 2005, Author : Nattapol Chittrichat
Email & MSN :
[email protected]
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**/
class WapTools {
function ascii2unicode($strin) {
$strlen = strlen($strin);
$strout = "";
for ($i=0;$i<$strlen;$i++) {
$char2convert = substr($strin,$i,1);
$ordValue = ord($char2convert);
if ($ordValue <= 159) {
$converted = $char2convert;
} elseif (($ordValue >= 161)&&($ordValue <= 319)) {
$converted = "�".strtoupper(dechex(($ordValue + 3584) - 160)).";";
} else {
$converted = "";
}
$strout = $strout.$converted;
}
return $strout;
}
function printthai($strin) {
echo $this->ascii2unicode($strin);
}
} // End Class WapTools
?>
สำหรับ php มีผล เกี่ยวกับการแสดง ภาษาไทย
ลองดูนี่ช่วย
PHP function สำหรับ WAP ข้อความภาษาไทย
อาจเป็นประโยชน์กับเพื่อนๆ ที่มีปัญหา ภาษาไทย ใน WAP ครับ
<?php
header("Content-type: text/vnd.wap.wml");
include("WapTools.class.php");
$wap = new WapTools();
?>
<wml>
<card id="card1" title="WAP Thai Demo">
<p>
<?php $wap->printthai("1. การคาดหวังของลูกค้าในงานบริการ"); ?><br/>
<?php $wap->printthai("2. ส่วนประสมทางการตลาด - ผลิตภัณฑ์ และราคา"); ?><br/>
<?php $wap->printthai("3. ส่วนประสมทางการตลาด - ช่องทางการจัดจำหน่ายและการ ส่งเสริมการตลาด"); ?><br/>
<?php $wap->printthai("4. ส่วนประสมทางการตลาดอื่น ๆ - บุคคล กระบวนการ และลักษณะทางกายภาพ"); ?><br/>
<?php $wap->printthai("5. กลยุทธ์ปกป้องตลาด, กลยุทธ์การเติบโต"); ?><br/>
</p>
</card>
</wml>
<?php
/**
WapTools.class.php
Copyright (C) 2005, Author : Nattapol Chittrichat
Email & MSN :
[email protected]This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**/
class WapTools {
function ascii2unicode($strin) {
$strlen = strlen($strin);
$strout = "";
for ($i=0;$i<$strlen;$i++) {
$char2convert = substr($strin,$i,1);
$ordValue = ord($char2convert);
if ($ordValue <= 159) {
$converted = $char2convert;
} elseif (($ordValue >= 161)&&($ordValue <= 319)) {
$converted = "�".strtoupper(dechex(($ordValue + 3584) - 160)).";";
} else {
$converted = "";
}
$strout = $strout.$converted;
}
return $strout;
}
function printthai($strin) {
echo $this->ascii2unicode($strin);
}
} // End Class WapTools
?>