0
我想从控制器发送逗号分隔值以在单个参数中建模方法。发送逗号分隔值作为单个参数
例如有模型的函数
public function bar($param1){
//....///
$this->datatables->edit_column($param1);
//....///
}
,并从控制器我试图发送PARAM像
public function foo(){
//...//
$param = "'username', '<a href="profiles/edit/$1">$2</a>', 'id, username'";
$this->model->bar($param);
//...//
}
,我面临的第一个顶级的问题是,我知道,只有两个字符''
和""
因为我不能发送这个适当的字符串,不好转义也:(
另外我想我是什么尝试g它将作为字符串在该函数内发送,但edit_column需要3个不同的逗号分隔值。
下面是我的整个数据表常用型号,它使用的DataTable点燃图书馆:
//Common DataTables Queries
function select_fields_joined_DT($data, $PTable, $joins = '', $where = '',$group_by = '', $addColumn = '', $editColumn = '',$unsetColumn = '')
{
$this->datatables->select($data);
if ($unsetColumn != '') {
$this->datatables->unset_column($unsetColumn);
}
$this->datatables->from($PTable);
if ($joins != '') {
foreach ($joins as $k => $v) {
$this->datatables->join($v['table'], $v['condition'], $v['type']);
}
}
if ($where != '') {
$this->datatables->where($where);
}
if($group_by != ''){
$this->datatables->group_by($group_by);
}
if ($addColumn != '') {
$this->datatables->add_column("Actions", $addColumn);
}
if ($editColumn != ''){
$this->datatables->edit_column($editColumn);
}
$result = $this->datatables->generate();
return $result;
}
//End of Common DataTables Queries
林stucked数据表的edit_column函数内。
的edit_column是假设像
$this->datatables->edit_column('username', '<a href="profiles/edit/$1">$2</a>', 'id, username');
只是想知道我怎么能发送由单一参数的逗号sepereated differen值? 还是我只需要发送的数组或东西..
这里是我怎么想保存3个逗号分隔值的变量...
$editColumn = "\'employee.employee_id\',\'<a href=\"dashboard_site/view_skills/$1\"><span class=\"fa fa-eye\"></span></a>\',\'employee.employee_id\'";