Skip to content

CHICPRO

  • Life Log
  • Cycling Log
  • Photo Log
    • Portrait
    • Landscape
    • Flower
    • Etc
  • Coding Log
  • Information

Tag: php

[PHP] 랜덤 시간으로 프로그램 실행 중지하기

2017-07-14 by 편리

PHP 7.0 이상에서 사용할 수 있는 random_int()함수를 이용해 랜덤 시간으로 프로그램 실행을 일시 중지하는 함수이다. <?php function randomSleep($n=5) { $int1 = random_int(21, 39); $int2 = random_int(21, 30); usleep(floor(bcdiv($int1, $int2, 6) * pow(10, $n))); } 위 함수를 사용하기 위해서는 bcmath 모듈이 설치되어 있어야 한다. <?php function randomTime() { $int1 = random_int(23, 43); $int2 = random_int(54, 74); return …

Continue Reading

[PHP] 아마존 Product Advertising API 간단 예제

2017-06-15 by 편리

아마존의 Product Advertising API 를 사용하기 위한 멋진 오픈소스가 존재하지만 서비스 구현 중에 그 오픈소스를 사용하면 네트웍 문제인지 간혹 제대로된 작업이 되지 않는 듯 하여 간단하게 코드를 작성해서 테스트를 해보기로 했다. 아래 코드는 테스트를 위해 작성한 것으로 최소한의 기능만 포함되어 있다. <?php class AMAZON { protected $country; protected $accessKey; protected $secretKey; protected $associateTag; protected $operation; protected …

Continue Reading

[PHP] PHPExcel을 이용한 엑셀파일 읽기

2017-05-29 by 편리

엑셀파일의 데이터를 읽어 DB에 저장하는 작업이 있어 PHPExcel을 이용해 기능을 구현했다. 아래 코드에서는 엑셀 파일에서 데이터를 읽어 $sheetData 에 배열로 저장하는 것까지만 된다. <?php require_once(‘./PHPExcel/IOFactory.php’); $file = ‘./excel.xlsx’; try { $inputFileType = PHPExcel_IOFactory::identify($file); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($file); } catch(Exception $e) { die(‘Error loading file “‘.pathinfo($file, PATHINFO_BASENAME).'” : ‘.$e->getMessage()); } $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, …

Continue Reading

[Python] rake-nltk 모듈을 이용한 키워드 추출

2017-05-18 by 편리

서비스 개발에 앞서 텍스트에서 주요한 키워드를 추출할 수 있는 기능을 테스트해보고 있다. RAKE (Rapid Automatic Keyword Extraction) 알고리즘을 이용했는데 파이썬에서는 쉽게 사용할 수 있는 모듈이 있어서 쉽게 구현할 수 있다. 사용한 모듈은 rake-nltk 이다. 그 외에 python-rake 모듈도 있으나 rake-nltk 모듈은 nltk 가 적용돼서 뭔가 좀 더 좋은 게 아닌가 싶어 사용했다. 사용은 PHP 에서 …

Continue Reading

[PHP] curl POST 전송 때 파라미터 전달되지 않는 경우 해결법

2017-04-28 by 편리

아래와 같이 PHP에서 POST 요청을 curl 로 처리할 때 $param 배열의 파라미터가 제대로 전달되지 않는 경우가 있다. <?php $url = ‘https://example.com/api’; $param = array( ‘mid’ => $mid, ‘key’ => $key, ‘token’ => $token ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $param); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); …

Continue Reading

Posts pagination

  • Previous
  • 1
  • …
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • …
  • 50
  • Next

Recent Posts

  • SK 세븐모바일 유심 셀프교체
  • php 배열 연산에서 + 와 array_merge 의 차이
  • pcntl_fork 를 이용한 다중 프로세스 실행
  • 아이폰 단축어를 이용하여 주중 공휴일엔 알람 울리지 않게 하기
  • 구글 캘린더 전체일정 재동기화
  • OpenLiteSpeed 웹서버에 HTTP 인증 적용
  • OpenLiteSpeed 웹어드민 도메인 연결
  • WireGuard를 이용한 VPN 환경 구축
  • Ubuntu 22.04 서버에 OpenLiteSpeed 웹서버 세팅
  • 맥 vim 세팅

Recent Comments

  • 편리 on 업무관리용 그누보드 게시판 스킨
  • 임종섭 on 업무관리용 그누보드 게시판 스킨
  • 캐논 5D 펌웨어 | Dslr 펌웨어 업그레이드 방법 82 개의 베스트 답변 on 캐논 EOS 30D 펌웨어 Ver 1.0.6 , EOS 5D 펌웨어 Ver 1.1.1
  • Top 5 캐논 5D 펌웨어 Top 89 Best Answers on 캐논 EOS 30D 펌웨어 Ver 1.0.6 , EOS 5D 펌웨어 Ver 1.1.1
  • 편리 on 워드프레스 애니메이션 gif 파일을 mp4로 변환하여 출력하기
  • 임팀장 on 워드프레스 애니메이션 gif 파일을 mp4로 변환하여 출력하기
  • 편리 on Notepad++ NppFTP 플러그인 수동 설치
  • paul-j on Notepad++ NppFTP 플러그인 수동 설치
  • YS on Windows 10 iCloud 사진 저장 폴더 변경
  • 편리 on Docker를 이용한 Centos7 + httpd + php 5.4 개발환경 구축

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
© 2025 CHICPRO | Built using WordPress and SuperbThemes