[PHP] 文字列がURLか判定する
<?php
$url = "https://www.example.com"; // Replace this with the string you want to check
if (filter_var($url, FILTER_VALIDATE_URL)) {
echo "Valid URL";
} else {
echo "Not a valid URL";
}
?>
<?php
$url = "https://www.example.com"; // Replace this with the string you want to check
if (filter_var($url, FILTER_VALIDATE_URL)) {
echo "Valid URL";
} else {
echo "Not a valid URL";
}
?>