PHP
-
PHP 매직함수 사용법PHP 2020. 6. 11. 17:16
class a{ public function __set($key, $value) { if(is_string($value)) { $value = trim($value)."1111"; } $this->__fields[$key] = $value; } public function __get($key) { if(array_key_exists($key, $this->__fields)) { return $this->__fields[$key]."2222"; } return null; } } $a = new a(); $a->a = "10"; // 저장시 __set 호출 저장값 : 101111 $c = $a->a; // 호출시 __get 호출됨 호출값 : 1011112222 => 저장된 값에 호출값에 추가로 더한 값이 나온다
-
-
그누보드 페이징 만들기PHP 2020. 6. 9. 14:38
= '".$year."-01-01' AND biz_operation_dtm = '".$result_cash_1."' ";}if(!empty($result_cash_2)){ $where[] = " biz_result_cash_3 function get_paging($write_pages, $cur_page, $total_page, $url, $add=""){ //$url = preg_replace('#&page=[0-9]*(&page=)$#', '$1', $url); $url = preg_replace('#&page=[0-9]*#', '', $url) . '&page='; $str = ''; if ($cur_page > 1) { $str ..
-
url 주소로 경로 판단PHP 2020. 6. 9. 14:37
if(!empty($_SERVER['SCRIPT_NAME'])) { $cls = array(); if(strpos($_SERVER['SCRIPT_NAME'], "/register_form")) { $cls[0] = "active"; } if(strpos($_SERVER['SCRIPT_NAME'], "/pay")) { $cls[1] = "active"; } if(strpos($_SERVER['SCRIPT_NAME'], "/pushing")) { $cls[2] = "active"; } if(strpos($_SERVER['SCRIPT_NAME'], "/point")) { $cls[3] = "active"; } }
-