본문 바로가기
study/php

phpspredsheet php 엑셀

by 땅콩잉 2021. 11. 24.
728x90
[root@supply test]# curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...

Composer (version 2.1.12) successfully installed to: /home/lyvly/composer.phar
Use it: php composer.phar

[root@supply test]# 
[root@supply test]# sudo mv composer.phar /usr/bin/composer
[root@supply test]# composer -V
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Composer version 2.1.12 2021-11-09 16:02:04
[root@supply test]# echo "export COMPOSER_ALLOW_SUPERUSER=1" >> ~/.bashrc
[root@supply test]# cat ~/.bashrc | grep export
export COMPOSER_ALLOW_SUPERUSER=1

겪은 문제 

-bash: composer: command not found

composer가 없다고 뜸

local로 옮겨서 그런거였고 전역으로 실행하려고

/usr/local/bin/composer로 해준걸 다음과 같이 수정. 

sudo mv composer.phar /usr/bin/composer

 

php 파일 상단에 추가

require_once '/home/lyvly/vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
function __construct()
{
    $this->oSpreadSheet = new Spreadsheet();
    $this->oSheet = $this->oSpreadSheet->getActiveSheet();
    parent::__construct();
}

'study > php' 카테고리의 다른 글

php 소수점 버림,올림,반올림  (0) 2021.11.19
php date 수정  (0) 2021.10.23
php 파일 패스워드(암호) 포함한 zip 압축파일  (0) 2021.10.19
php csv 0 사라질때  (0) 2021.10.01
php 엑셀 다운로드 시 한글 깨짐  (0) 2021.09.14

댓글