# iframe 태그를 추출한다.
//preg_match_all("/(<(iframe+)[^>]*>)(.*?)(<\/\\2>)/", $wr_content, $matches);
preg_match_all("/(<(iframe+)([^>]*)>)(.*?)(<\/(iframe)>)/", $wr_content, $matches);
if(is_array($matches[3]) == true && count($matches[3]) > 0) {
// 태그가 있음
} else {
// 태그가 없음
}
# 추출한 결과를 확인
print_r2($matches);
[PHP] 정규식으로 태그 추출하기
그누보드 스킨을 수정하다가 생성한 코드
[PHP] 유니코드 한글 단어를 첫글자(초성)를 기준으로 가, 나, 다, ... 분류로 나누기
# 한글단어의 초성을 기준으로 가,나,다로 구분한다. [사용처 : 단어사전 등의 색인 검색]
if( ! function_exists('check_unicode_ord')) {
# 단어의 초성을 기준으로 가/나/다 구분하는 함수
function check_unicode_ord($string) {
$h = unicode_ord($string);
if($h >= 44032 && $h <= 45207) return "가";
if($h >= 45208 && $h <= 45795) return "나";
if($h >= 45796 && $h <= 46971) return "다";
if($h >= 46972 && $h <= 47559) return "라";
if($h >= 47560 && $h <= 48147) return "마";
if($h >= 48148 && $h <= 49323) return "바";
if($h >= 49324 && $h <= 50499) return "사";
if($h >= 50500 && $h <= 51087) return "아";
if($h >= 51088 && $h <= 52263) return "자";
if($h >= 52264 && $h <= 52851) return "차";
if($h >= 52852 && $h <= 53439) return "카";
if($h >= 53440 && $h <= 54027) return "타";
if($h >= 54028 && $h <= 54615) return "파";
if($h >= 54616 && $h <= 55203) return "하";
return "기타";
}
function unicode_ord($string) {
$h = ord($string{0});
if ($h <= 0x7F) {
return $h;
} else if ($h < 0xC2) {
return false;
} else if ($h <= 0xDF) {
return ($h & 0x1F) << 6 | (ord($string{1}) & 0x3F);
} else if ($h <= 0xEF) {
return ($h & 0x0F) << 12 | (ord($string{1}) & 0x3F) << 6 | (ord($string{2}) & 0x3F);
} else if ($h <= 0xF4) {
return ($h & 0x0F) << 18 | (ord($string{1}) & 0x3F) << 12 | (ord($string{2}) & 0x3F) << 6 | (ord($string{3}) & 0x3F);
} else {
return false;
}
}
}
사용방법
$kr_key = check_unicode_ord($string);
// '도라지' => '다'
// '백화점' => '바'
[PHP] 디렉토리가 존재하는지, 쓰기권한이 있는지 미리 검사
1. 디렉토리가 있는지 검사한다.
2. 디렉토리에 쓰기권한이 있는지 검사한다.
2. 디렉토리에 쓰기권한이 있는지 검사한다.
$dir = "/home/www/dir/upload";
if(is_dir($dir)==false) {
echo "디렉토리가 존재하지 않습니다."; exit;
}
if(is_writable($dir)==false) {
echo "디렉토리에 쓰기권한이 없습니다."; exit
}
피드 구독하기:
글 (Atom)
[SSL] [letsencrypt] [certbot] 와일드카드 인증서 발급하기
1. 환경 ubuntu 20.x nginx 2. 설치 apt-get install letsencrypt -y 3. 인증서 발급 ; example.com 도메인에 대해 와일드카드 인증서를 발급받는다. certbot certonly --ma...
-
<ul> <li>리스트 : 현재의 SQL문에 조건 추가 (상태처리값에 따른 구분 필요함)</li> <li>삭제 : 개별삭제, 선택삭제, 전체삭제</li> <li>견적...
-
box-shadow: h-offset(오른쪽) v-offset(아래쪽) blur spread color; box-shadow:1px 0 0 0 #aaaaaa; [오른쪽 1px 효과) box-shadow:0 1px 0 0 #aaaaaa; [아래쪽 1...
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.3.3/css/swiper.min.css"> <script...