PHP
$this->data['months'] = array();
for ($i = 1; $i <= 12; $i++) {
$this->data['months'][] = array(
'text' => strftime('%B', mktime(0, 0, 0, $i, 1, 2000)),
'value' => sprintf('%02d', $i)
);
$_['months'][] = array("Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık");
HTML
<select name="cc_expire_date_month">
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
我无法改变这几个月的语言。我该怎么改变$ _ [''月'] []到什么呢?又想要太多细节请帮助我无法改变那种形式选择元素的语言
答案 0 :(得分:0)
$weird_months=array("Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık");
$this->data['months'] = array();
for ($i = 1; $i <= 12; $i++) {
$this->data['months'][] = array(
'text' => $weird_months[$i-1],
'value' => sprintf('%02d', $i)
);
答案 1 :(得分:0)
将您的html放入php,然后创建会话变量语言:
if(isset($_SESSION["language"])){
if($_SESSION["language"]=="EN"){
include_once("languages/languageEN.php");
}
if($_SESSION["language"]=="WHATEVER"){
include_once("languages/languageWHATEVER.php");
}
}else{
include_once("languages/languageEN.php");
}
<select name="cc_expire_date_month">
<option value="01"><?php echo MONTH1; ?></option>
<option value="02"><?php echo MONTH2; ?></option>
<option value="03"><?php echo MONTH3; ?></option>
<option value="04"><?php echo MONTH4; ?></option>
<option value="05"><?php echo MONTH5; ?></option>
<option value="06"><?php echo MONTH6; ?></option>
<option value="07"><?php echo MONTH7; ?></option>
<option value="08"><?php echo MONTH8; ?></option>
<option value="09"><?php echo MONTH9; ?></option>
<option value="10"><?php echo MONTH10; ?></option>
<option value="11"><?php echo MONTH11; ?></option>
<option value="12"><?php echo MONTH12; ?></option>
</select>
在languageEN.php或languageWHATEVER.php上:
<?php
define('MONTH_1','January');
define('MONTH_2','February');
define('MONTH_3','March');
define('MONTH_4','April');
define('MONTH_5','May');
define('MONTH_6','June');
define('MONTH_7','July');
define('MONTH_8','August');
define('MONTH_9','September');
define('MONTH_10','October');
define('MONTH_11','November');
define('MONTH_12','December');
?>