PHP
-
file php 소스코드형식으로 저장하기PHP 2020. 5. 15. 15:14
$sub_menu = '400330';include_once('./_common.php');include_once(G5_LIB_PATH.'/iteminfo.lib.php');$fp = fopen(G5_LIB_PATH.'/iteminfo.lib.php', 'w');$item_info[$_POST["info_val"]] = array("title" => $_POST["info_subj"], "article" => array());foreach($_POST["it_val"] as $key => $val){ $item_info[$_POST["info_val"]]["article"][$val] = array($_POST["it_subj"]..
-
이름 마스킹 처리(맨앞과 뒤만 출력)PHP 2020. 5. 6. 18:52
function markingName($text){ $length = mb_strlen($text, "utf-8"); $andMarking = ""; for($i = 2; $i { $andMarking .= "*"; } $sMarking = mb_substr($text, 0, 1, 'utf-8'); $eMarking = mb_substr($text, $length - 1, $length, 'utf-8'); return $sMarking.$andMarking.$eMarking; }?>
-
핸드폰 구분자 넣기PHP 2020. 5. 6. 18:51
function format_phone($phone){ $phone = preg_replace("/[^0-9]/", "", $phone); $length = strlen($phone); switch($length){ case 11 : return preg_replace("/([0-9]{3})([0-9]{4})([0-9]{4})/", "$1-$2-$3", $phone); break; case 10: return preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "$1-$2-$3", $phone); break; case 9: return preg_replace("/([0-9]{2})([0-9]{3})([0-9]{4})/", "$1-$2-$3", $phone); break..
-
날짜계산 함수PHP 2020. 5. 6. 18:51
function diffdate($date1, $date2){ $diff = abs(strtotime($date2) - strtotime($date1)); $years = floor($diff / (365*60*60*24)); $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); $days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); $time = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days * 60*60*24)/ (60*60)) ; $minute = floor(($diff -..
-
날짜PHP 2020. 5. 6. 18:50
$last = date("t", strtotime($year."-".$month."-01 00:00:00")); //해당달의 마지막 날짜한달전 $start = date("Y-m-01", strtotime("-1 month", time())); $end = date("Y-m-".date("t", strtotime($start)), strtotime("-1 month", time())); //시작일~~종료일 출력 $start = strtotime($sc["sc_date_start"]); $end = strtotime($sc["sc_date_end"]); while ($start