日期:2014-05-16  浏览次数:20453 次

PHP如何做到自动发送GET请求?

<?php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHP如何做到自动发送GET请求?</title>
</head>
<body>
<br/><a href="https://127.0.0.1/aaa.htm?a=1&b=33&c=1">连接</a>
</body>
</html>
?>


PHP文件。
如上代码中,如何做到当打开这个页面的时候,自动点击里面的“连接”并跳转。
------解决方案--------------------
直接用head location 跳转。
<?php header( 'Location: https://127.0.0.1/aaa.htm?a=1&b=33&c=1' ) ; ?>
------解决方案--------------------

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>PHP如何做到自动发送GET请求?</title>
</head>
<body>
<a id="url" href="https://127.0.0.1/aaa.htm?a=1&b=33&c=1">连接</a>
<script type="text/javascript">
window.location = document.getElementById("url").href;
</script>
</body>
</html>