"함수 is url()"의 두 판 사이의 차이

5번째 줄: 5번째 줄:
==PHP==
==PHP==
[[분류: PHP]]
[[분류: PHP]]
<source lang='PHP'>
function is_url($url) { return filter_var($url, FILTER_VALIDATE_URL) );
</source>
<source lang='PHP'>
function is_url($url) { return (bool)parse_url($url); }
</source>
<source lang='PHP'>
<source lang='PHP'>
function is_url($url) { return preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$url);
function is_url($url) { return preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$url);

2015년 8월 18일 (화) 10:08 판

is_url()

1 PHP

function is_url($url) { return filter_var($url, FILTER_VALIDATE_URL) );
function is_url($url) { return (bool)parse_url($url); }
function is_url($url) { return preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$url);
}

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}