0
我試圖加載一個Excel的xlsx文件模板是動態的,我試着用下面的方法:PhpExcel加載動態模板
$approve_employee_id = $this->input->post('approve_employee_id');
$query = "SELECT * from employee where employee.employee_id='$approve_employee_id'";
$query = $this->db->query($query);
foreach ($query->result() as $value) {
$f_name = $value->f_name;
$s_name = $value->s_name;
$user_name = $value->user_name;
$under_score = "_";
$file_name = $user_name . $under_score . $approve_month_id . $under_score . $approve_year_name;
$folder_name = $approve_month_id . $approve_year_name;
$basedir = $_SERVER['DOCUMENT_ROOT'] . "/timesheet/files";
$this->load->library('excel');
$objPHPexcel = PHPExcel_IOFactory::load("/Applications/MAMP/htdocs/timesheet/files/un_approved/'$file_name'.xlsx");
echo 'Loading template successfull...';
$objWorksheet = $objPHPexcel->getActiveSheet();
}
我怎樣才能以動態的方式加載的文件名? 以下是該文件的名稱之一:HS103_January_2014
那麼是什麼問題,你實際上有?它是否加載模板文件?它是否顯示任何錯誤消息?你的文件名中是否有單引號? – 2014-09-04 08:42:56