Codeigniter消息:数组到字符串转换

时间:2012-08-22 08:25:52

标签: codeigniter

我在CodeIgniter安装中遇到以下错误,我似乎无法解决:

  

遇到严重错误:通知

     

消息:数组到字符串转换

     

文件名:helpers / form_helper.php

     

行号:515

这是我的代码

 <div class="control-group">
                <?php $attributes = array('class' => 'control-label'); echo form_label(lang('settings_dateofbirth'),$attributes); ?>
                <div class="controls">   
                <?php $m = $this->input->post('settings_dob_month') ? $this->input->post('settings_dob_month') : (isset($account_details->dob_month) ? $account_details->dob_month : ''); ?>
                <select name="settings_dob_month" class="span1">
                    <option value=""><?php echo lang('dateofbirth_month'); ?></option>
                    <option value="1"<?php if ($m == 1) echo ' selected="selected"'; ?>><?php echo lang('month_jan'); ?></option>
                    <option value="2"<?php if ($m == 2) echo ' selected="selected"'; ?>><?php echo lang('month_feb'); ?></option>
                    <option value="3"<?php if ($m == 3) echo ' selected="selected"'; ?>><?php echo lang('month_mar'); ?></option>
                    <option value="4"<?php if ($m == 4) echo ' selected="selected"'; ?>><?php echo lang('month_apr'); ?></option>
                    <option value="5"<?php if ($m == 5) echo ' selected="selected"'; ?>><?php echo lang('month_may'); ?></option>
                    <option value="6"<?php if ($m == 6) echo ' selected="selected"'; ?>><?php echo lang('month_jun'); ?></option>
                    <option value="7"<?php if ($m == 7) echo ' selected="selected"'; ?>><?php echo lang('month_jul'); ?></option>
                    <option value="8"<?php if ($m == 8) echo ' selected="selected"'; ?>><?php echo lang('month_aug'); ?></option>
                    <option value="9"<?php if ($m == 9) echo ' selected="selected"'; ?>><?php echo lang('month_sep'); ?></option>
                    <option value="10"<?php if ($m == 10) echo ' selected="selected"'; ?>><?php echo lang('month_oct'); ?></option>
                    <option value="11"<?php if ($m == 11) echo ' selected="selected"'; ?>><?php echo lang('month_nov'); ?></option>
                    <option value="12"<?php if ($m == 12) echo ' selected="selected"'; ?>><?php echo lang('month_dec'); ?></option>
                </select>
                <?php $d = $this->input->post('settings_dob_day') ? $this->input->post('settings_dob_day') : (isset($account_details->dob_day) ? $account_details->dob_day : ''); ?>
                <select name="settings_dob_day" class="span1">
                    <option value="" selected="selected"><?php echo lang('dateofbirth_day'); ?></option>
                    <?php for ($i=1; $i<32; $i++) : ?>
                    <option value="<?php echo $i; ?>"<?php if ($d == $i) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
                    <?php endfor; ?>
                </select>
                <?php $y = $this->input->post('settings_dob_year') ? $this->input->post('settings_dob_year') : (isset($account_details->dob_year) ? $account_details->dob_year : ''); ?>
                <select name="settings_dob_year" class="span1">
                    <option value=""><?php echo lang('dateofbirth_year'); ?></option>
                    <?php $year = mdate('%Y', now()); for ($i=$year; $i>1900; $i--) : ?>
                    <option value="<?php echo $i; ?>"<?php if ($y == $i) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
                    <?php endfor; ?>
                </select>
                <?php if (isset($settings_dob_error)) : ?>
                <span class="field_error"><?php echo $settings_dob_error; ?></span>
                <?php endif; ?>
            </div>
            </div>

有人可以解释这与此有什么关系吗?

1 个答案:

答案 0 :(得分:2)

错误是指form_label。第二个参数应该是一个字符串,而第三个参数可以是一个数组。

 form_label(lang('settings_dateofbirth'), 'dateofbirth', $attributes);