728x90
Codeigniter(이하 ci)에 엑셀 다운로드를 하기 위해 PHPExcel 라이브러리를 연동하는 방법입니다. 우선 앞에 링크를 통해서 원본을 다운로드 받으세요. Download ZIP 부분을 클릭하시면 됩니다(이제 더 운영(?) 안 하는 레파지토리라서 아마 이 링크 클릭하셔서 받으셔도 될 겁니다).
그런 후 zip 파일을 압축 푼 후 ftp로 업로드를 합니다.
아마 압축을 풀면 안에 파일이나 폴더가 저렇게 나올 겁니다. 저것들 다 업로드 하지 마시고 Classes 폴더 안에 있는 PHPExcel 폴더랑 PHPExcel.php 파일만 업로드 하시면 됩니다.
위치는 /application/third_party/ 여기입니다.
그런 후 /application/libraries/ 디렉토리에 Excel.php 파일을 생성하세요.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
require_once APPPATH.'/third_party/PHPExcel/Classes/PHPExcel.php'; | |
class Excel extends PHPExcel { | |
public function __construct() { | |
parent::__construct(); | |
} | |
} |
그리고 위 코드를 다 복사해서 넣으시면 됩니다.
이제 필요한 페이지에서 $this->load->library('excel'); 이런 식으로 해서 사용하시면 됩니다.
반응형
'Programming > PHP' 카테고리의 다른 글
외부 SMTP를 이용해서 메일 보내기 - 2(feat. PHPMailer)[추가@20230412] (0) | 2022.12.07 |
---|---|
외부 SMTP를 이용해서 메일 보내기 - 1(feat. PHPMailer) (0) | 2022.11.25 |
강제로 404 발생시키기 (0) | 2022.11.09 |
관리자 로그인에 구글 OTP 적용하기 (0) | 2022.06.23 |
[고도몰5]커스터마이징하기 전에 알아야 할... (2) | 2022.05.11 |