这是我的代码片段:
<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class sample{
function __construct() {
$this->ci = & get_instance();
}
public $name;
public $style;
function set_data($data)
{
/* List of parameters that you can set */
$this->name = (isset($data['name']) ? $data['name']: ''); // Set select name
$this->style = (isset($data['style']) ? $data['style']: ''); // Set select style
}
function select_both_dropdown()
{
$select = '<select name="'.$this->name.'" class="chzn-select" style="'.$this->style.'">';
$select .= '<option value=""></option>';
$select .= '</select>';
return $select;
}
控制器:
$data['select'] = $this->sample->select_both_dropdown(array(
'name' => 'eventselect',
'style' => 'min-width: 247px;'
));
它是如何在控制器中加载的:function _construct( ) { parent:: _construct(); $this->load->library('tank_auth'); $this->load->library('sample'); }
当屏幕上的“选择负载”上没有填充。没有名称,没有样式等。我在做什么错?