我有以下数组。
$t= array('Super User','Admin_Sub','Catalog Management User','Order Management User','CustomerCare_Head','CustomerCare_Sub',' Finance Management User',
'Logistic Management User','Logistic_Sub','SEO_Head','SEO_Sub','Marketing Management User','Marketing_Sub','Cat_Man','Design','Business Development','Reviews',
'Catalot Management Primary User','Catalot Management Secondary User');
如果我打印数组,它显示为null。
$t= array('Super User','Admin_Sub','Catalog Management User','Order Management User','CustomerCare_Head','CustomerCare_Sub',' Finance Management User',
'Logistic Management User','Logistic_Sub','SEO_Head','SEO_Sub','Marketing Management User','Marketing_Sub','Cat_Man','Design','Reviews');
如果我打印这个数组,它打印得很好。
我已删除('业务发展', 来自第二阵列的'Catalot Management Primary User','Catalot Management Secondary User)。这三个值阻止数组打印。我尽一切可能但没有成功。
提前的Thanx:)
P.S:我忘了提到它不能在Excel中打印。我将其作为下拉列表导入Excel文件
Excel::create('Users', function ($excel) use ($rs, $role_final) {
$excel->sheet('Users', function ($sheet) use ($rs, $role_final) {
if (count($rs['attachData']) > 0) {
$arr_csv = array_merge($this->arr_user, $rs['attachData']);
} else {
$arr_csv = $this->arr_user;
}
$t= array('Super User','Admin_Sub','Catalog Management User','Order Management User','CustomerCare_Head','CustomerCare_Sub',' Finance Management User',
'Logistic Management User','Logistic_Sub','SEO_Head','SEO_Sub','Marketing Management User','Marketing_Sub','Cat_Man','Design','Business Development','Reviews',
'Catalot Management Primary User','Catalot Management Secondary User');
$user_role = implode(',',$t);
$user_roles[0] = $user_role;
$sheet->rows(array($arr_csv));
$this->getDropDownListWithValidation($sheet, 'E', implode('","', $user_roles));
$sheet->setFontSize(10);
$sheet->row(1, function ($row) {
$row->setFontWeight('bold');
});
$sheet->freezeFirstRow();
});
})
->export('xls');
protected function getDropDownListWithValidation($sheet, $cell, $items)
{
$objValidation = $sheet->getCell($cell . $i)->getDataValidation();
$objValidation->setType(\PHPExcel_Cell_DataValidation::TYPE_LIST);
$objValidation->setErrorStyle(\PHPExcel_Cell_DataValidation::STYLE_INFORMATION);
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
$objValidation->setShowDropDown(true);
$objValidation->setErrorTitle('Input error');
$objValidation->setError('Value is not in list.');
$objValidation->setPromptTitle('Pick from list');
$objValidation->setPrompt('Please pick a value from the drop-down list.');
$objValidation->setFormula1('"' . $items . '"');
}
return $objValidation;
}
答案 0 :(得分:0)
尝试以下代码
$t= array('Super User','Admin_Sub','Catalog Management User',
'Order Management User','CustomerCare_Head',
'CustomerCare_Sub',' Finance Management User',
'Logistic Management User',
'Logistic_Sub','SEO_Head','SEO_Sub',
'Marketing Management User',
'Marketing_Sub','Cat_Man','Design','Reviews');
$t1= array('Super User','Admin_Sub','Catalog Management User','Order Management User','CustomerCare_Head','CustomerCare_Sub',' Finance Management User',
'Logistic Management User','Logistic_Sub','SEO_Head','SEO_Sub','Marketing Management User','Marketing_Sub','Cat_Man','Design','Business Development','Reviews',
'Catalot Management Primary User','Catalot Management Secondary User');
echo "<pre>";
print_r($t);
print_r($t1);