这是我的代码
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="text"/>
<input type="submit" name="submit" value="submit"/>
</form>
<?php
if(isset($_POST['submit'])){
$url = $_POST['text'];
$parse = parse_url($url);
echo $parse['host'];
}
?>
Run Code Online (Sandbox Code Playgroud)
我使用parse_url以获取主机的名称,当有人输入URL,如果我现在试着输入一些垃圾输入到输出,它给出了一个错误:"未定义指数:主机",我想知道我们如何检查是否其在回显parse_url函数的输出之前,有效的url或只是一个字符串
<style>
#count2{
visibility:hidden;
}
#count1:hover{
background:#123456;
//how do I change the visibility property of #count2 here?
}
</style>
<div id="count1">My visible element</div>
<div id="count2">My flickering element</div>
Run Code Online (Sandbox Code Playgroud)
我的问题很清楚,但可能有点奇怪.当有人在#count1上徘徊时,如何仅使用css,将#count2的visibility属性更改为true.