본문 바로가기

PHP 절대경로 절대경로 : $_SERVER[DOCUMENT_ROOT] 더보기
php insert_id 입력된 바로 그값의 PK(Primary Key)를 가져오는 명령 php insert_id DB에 입력후 PK UID를 받아올때 사용. 2가지 방법이 있는데 mysql_insert_id() 과 last_insert_id() 입니다.mysql_insert_id()은 PHP에서 처리해주는 명령문이고 last_insert_id()는 MySQL에서 처리해 주는 함수 입니다.INSERT 명령으로 입력된 바로 그값의 PK(Primary Key)를 가져오는 명령을 수행합니다. 출처: http://jos39.tistory.com/191 [JOS39 블로그] $no = $db->insert_id; 실시 예 (PDO) 더보기
sprintf(), hash(), uniqid(); header("Content-Type: text/html; charset=UTF-8");$data = sprintf("%04d%02d%02d",2017,8,02);echo $data;echo "";echo "";echo "";echo hash('MD5','test')."";echo hash('SHA256','test')."";echo hash('SHA256',uniqid(rand(),1))."";echo "";echo "";echo "";echo uniqid()."";echo uniqid("",1)."";echo uniqid(rand())."";echo uniqid(rand(),1)."";?> 더보기
$_SERVER 함수 http://php.net/manual/en/reserved.variables.server.php 더보기
define() 초기설정값 셋팅 //****************//데이터베이스 관련 설정하기//****************//데이터베이스 사용자 설정하기define("_DB_USER","user1");//데이터베이스 비밀번호 설정하기define("_DB_PASS", "test");//데이터베이스 호스트명define("_DB_HOST","localhost");//데이터베이스명define("_DB_NAME","sample");//데이터베이스 종류define("_DB_TYPE","mysql");//데이터 소스define("_DSN",_DB_TYPE.":host="._DB_HOST.";dbname="._DB_NAME.";charset=utf8");//*******************// 세션명//*******************//회원.. 더보기
배열, 연관배열 그리고 forEach header("Content-Type: text/html; charset=UTF-8");    $fruit[] = "사과";    $members = explode('/',"서울/대전/대구/부산");    echo "";    echo $members[0];    echo "";    echo $members[1];    echo "";    echo $members[2];    echo "";    echo $members[3];    echo "";    echo "";    echo "";    foreach($members as $val){        echo $val."";    }    echo "";    echo "";    echo "";    $user["name"] = "홍길동"; .. 더보기
예외처리(try ~ catch) header("Content-Type: text/html; charset=UTF-8");    function chkNum($num){        if($num > 1){            throw new Exception("숫자가 1보다 큼");        }        return true;    }    try{        chkNum(2);        print "숫자는 1보다 작음";    }catch(Exception $e){        print "메세지: ".$e->getMessage();    }?>    header("Content-Type: text/html; charset=UTF-8");    class customException extends Exception{  .. 더보기
간단한 로그인예제(Session) 로그인 ID : PW : 로그인 더보기
PDO 데이터 베이스 접속 header("Content-Type: text/html; charset=UTF-8");try{    // MySQL PDO 객체 생성    // mysql을 다른 DB로 변경하면 다른 DB도 사용 가능    $pdo = new PDO('mysql:host=localhost;dbname=homesi;charset=utf8','userId','userPw');    // 에러 출력    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);    print "데이터 베이스 접속 성공";}catch(Exception $e) {    echo$e->getMessage();}?> 더보기
쿠키 header("Content-Type: text/html; charset=UTF-8");    setcookie("testCookie","쿠키다", time()+10);?>    header("Content-Type: text/html; charset=UTF-8");    echo "쿠키 값: ".$_COOKIE['testCookie'];?> 더보기
난수생성 print "rand: ".mt_rand(1000,9999); print ""; print "date: ".date('YmdHis'); print ""; print "time: ".time(); ?> 더보기
시간관련 함수 $d=strtotime("tomorrow");echo date("Y-m-d h:i:sa", $d) . "";$d=strtotime("next Saturday");echo date("Y-m-d h:i:sa", $d) . "";$d=strtotime("+3 Months");echo date("Y-m-d h:i:s", $d) . "";?> 더보기
알림 API 다루기 디바이스정보디바이스모션알림(notification)파일관리폴더관리 hybridApp 알림(notification) 결과 : 뒤로.. hybridApp var onAccelerometerSuccess = function(acceleration){$("#x").text(acceleration.x);$("#y").text(acceleration.y);$("#z").text(acceleration.z);$("#time").text(acceleration.timestamp);} var onAccelerometerFail = function(message){alert(message);} var onAlert = function(){$("#result").text("alert");} var onConf.. 더보기
디바이스 가속도계 얻기 API 다루기 디바이스정보디바이스모션알림(notification)파일관리폴더관리 hybridApp 디바이스 모션 X축 : Y축 : Z축 : timestamp : 뒤로.. hybridApp index.js var onAccelerometerSuccess = function(acceleration){$("#x").text(acceleration.x);$("#y").text(acceleration.y);$("#z").text(acceleration.z);$("#time").text(acceleration.timestamp);} var onAccelerometerFail = function(message){alert(message);} var onDeviceReady = function(){ $('#device.. 더보기
디바이스 정보 얻기 index.html PhoneGap 디바이스 정보 deviceInfo.html 디바이스 정보 가져오기cordova : model : platform : uuid : version : 뒤로..hybridApp index.js var onDeviceReady = function(){ $('#device').text(device.cordova); $('#model').text(device.model); $('#platform').text(device.platform); $('#uuid').text(device.uuid); $('#version').text(device.version);} var init = function(){ document.addEventListener('deviceready', onDev.. 더보기
mobile API - parseUrl parseUrl footer 더보기
mobile API - changePage changePage basictransitionreversechangeHashdatatypedataUrlreloadPageshowLoadMsg footerSecond Page뒤로...페이지 이동Third PageThird 페이지 입니다....뒤로 더보기
디바이스 방향계 방향 정보를 다루는 두가지 방법의 javaScript 이벤트가 있다. 1. deviceorientation 이벤트 : 가속도계(accelerometer)가 기기의 방향 변화를 감지했을 때 발생 - 3개의 각도를 사용하여 측정하고 4개의 값을 갖는다.    . absolute : 지구좌표계(Earth coordinate system)을 사용하는 지에 대한 boolean값이다. 일반적인 경우 사용하지 않는다.        . alpha : 0도 부터 360도 까지 범위의 z축을 중심으로 움직임을 나타낸다.    . beta : x축을 중심으로 디바이스의 움직임을 나타낸다. -180도에서 180도    . gamma : y축을 중심으로 디바이스의 움직임을 나타낸다.  2. devicemot.. 더보기
applicaton cache Application Cache footer common.css@charset "utf-8"; #firstPg{background:#ddd;} common.jswindow.onload=function(){ } cache.manifestCACHE MANIFEST# 주석시 사용하는 기호는 '#' 이다.# 매니페스트에 명시된 파일은 한번 브라우저에 캐쉬된 이후 다시 갱신되지 않는다.# 만일 캐쉬된 파일이 수정되어서 다시 캐쉬를 갱신해야 하는 경우에는 매니페스트 파일의 # 내용을 수정해야한다.# 매니페스트 파일을 수정하는 경우에는 날짜나 버전을 변경하여 처리한다.# 그럴경우 주석처리해서 표시한다.# manifest version : v1.0 2016-01-21 CACHE:./common.css./common.j.. 더보기
[jQuery Mobile] 미디어 플레이어 조작 미디어 재생시작중지볼륨업볼륨다운footer 더보기