我创建了一个功能,我需要从内容中提取URL。我不知道哪里出错了。这是我的代码..
function strip_url_content($content){
$strip = explode("\n", esc_html($content));
foreach($strip as $key => $single){
if (!filter_var($single, FILTER_VALIDATE_URL) === true) {
unset($strip[$key]);
}
}
return implode( ' ', $strip );
}