Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 控制自己的浏览器的脚本_Php_Javascript_Web_Hyperlink - Fatal编程技术网

Php 控制自己的浏览器的脚本

Php 控制自己的浏览器的脚本,php,javascript,web,hyperlink,Php,Javascript,Web,Hyperlink,所以我正在调试我的网站。。。基本上,我需要做的是编写一个脚本,定期跟踪页面上的链接,但我需要在浏览器中看到结果,这就是为什么我需要在浏览器中执行它。我希望它每隔几秒钟点击一次相同的链接,而不需要任何人机交互。 每次生成的页面都将具有与上次相同的结构,因此链接将具有相同的属性和所有内容。。。这让我觉得我可能可以使用Javascript来完成这项任务,但我不确定如何使用。也许firefox中的greasemonkey?问题是我唯一擅长的语言是PHP,我想不出任何使用PHP的解决方案。 我想用它做的一

所以我正在调试我的网站。。。基本上,我需要做的是编写一个脚本,定期跟踪页面上的链接,但我需要在浏览器中看到结果,这就是为什么我需要在浏览器中执行它。我希望它每隔几秒钟点击一次相同的链接,而不需要任何人机交互。 每次生成的页面都将具有与上次相同的结构,因此链接将具有相同的属性和所有内容。。。这让我觉得我可能可以使用Javascript来完成这项任务,但我不确定如何使用。也许firefox中的greasemonkey?问题是我唯一擅长的语言是PHP,我想不出任何使用PHP的解决方案。 我想用它做的一件事是让它以伪随机的间隔来做。。。比如15秒到60秒之间。。。这就是为什么我认为我需要一个脚本,而不是一个现有的程序或东西。。。
所以如果有人有任何想法,谢谢

您还可以使用JavaScript在给定时间段后自动刷新页面。在这里,我们在页面加载5秒后刷新页面。这会导致页面每5秒持续刷新一次

<html>
<head>
<script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
    setTimeout("location.reload(true);",timeoutPeriod);
}
//   -->
</script>
</head>
<body onload="JavaScript:timedRefresh(5000);">
<p>This page will refresh every 5 seconds. This is because we're using the 'onload' event to call our function. We are passing in the value '5000', which equals 5 seconds.</p>
<p>But hey, try not to annoy your users too much with unnecessary page refreshes every few seconds!</p>
</body>
</html>

此页面将每5秒刷新一次。这是因为我们正在使用“onload”事件来调用我们的函数。我们正在传递值“5000”,它等于5秒

<html>
<head>
<script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
    setTimeout("location.reload(true);",timeoutPeriod);
}
//   -->
</script>
</head>
<body onload="JavaScript:timedRefresh(5000);">
<p>This page will refresh every 5 seconds. This is because we're using the 'onload' event to call our function. We are passing in the value '5000', which equals 5 seconds.</p>
<p>But hey, try not to annoy your users too much with unnecessary page refreshes every few seconds!</p>
</body>
</html>
但是,嘿,不要每隔几秒钟就用不必要的页面刷新来打扰你的用户


您还可以使用JavaScript在给定时间段后自动刷新页面。在这里,我们在页面加载5秒后刷新页面。这会导致页面每5秒持续刷新一次

<html>
<head>
<script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
    setTimeout("location.reload(true);",timeoutPeriod);
}
//   -->
</script>
</head>
<body onload="JavaScript:timedRefresh(5000);">
<p>This page will refresh every 5 seconds. This is because we're using the 'onload' event to call our function. We are passing in the value '5000', which equals 5 seconds.</p>
<p>But hey, try not to annoy your users too much with unnecessary page refreshes every few seconds!</p>
</body>
</html>

此页面将每5秒刷新一次。这是因为我们正在使用“onload”事件来调用我们的函数。我们正在传递值“5000”,它等于5秒

<html>
<head>
<script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
    setTimeout("location.reload(true);",timeoutPeriod);
}
//   -->
</script>
</head>
<body onload="JavaScript:timedRefresh(5000);">
<p>This page will refresh every 5 seconds. This is because we're using the 'onload' event to call our function. We are passing in the value '5000', which equals 5 seconds.</p>
<p>But hey, try not to annoy your users too much with unnecessary page refreshes every few seconds!</p>
</body>
</html>
但是,嘿,不要每隔几秒钟就用不必要的页面刷新来打扰你的用户


您需要这个做什么?如果这是为了测试Web前端,那么看看您需要它做什么?如果这是为了测试Web前端,请查看