【问题标题】:Free script to open multiple URLs at once一次打开多个 URL 的免费脚本
【发布时间】:2011-04-12 12:08:27
【问题描述】:

我正在寻找可以一次打开多个 URL 的免费 PHP 脚本。如果有人找到任何地方,请告诉我。

提前致谢。

【问题讨论】:

    标签: php javascript url


    【解决方案1】:

    您可能想要影响客户端的行为,在这种情况下您不需要 PHP。普通的旧 HTML + Javascript 就可以了:

    <a href="#" onclick="window.open('http://www.google.com'); 
                    window.open('http://yahoo.com');">Open Google and Yahoo</a>
    

    这可能会被弹出窗口拦截器捕获。

    要使用 PHP 生成这样的代码,只需:

    // say your links are in an array:
    $links = array('http://www.google.com', 'http://www.yahoo.com');
    
    $open = '';
    foreach ($links as $link) {
        $open .= "window.open('{$link}'); ";
    }
    
    echo "<a href=\"#\" onclick=\"{$open}\">Open multiple links</a>";
    

    【讨论】:

    • 我将在我的网站上创建一个页面并测试您的代码。我很快更新了状态。谢谢你的帮助!马尼姆
    • 亲爱的 NullUserException - 感谢您的脚本。实际上,我正在为我的网站页面寻找一个 php 脚本。请参考链接:golink-directory.com/seo/openurl.php --- 类似这样。
    • @Manim:你知道你可以查看网页的源代码,对吧?执行您想要的操作的代码在您链接到的网页上。
    • 嗨 Mikey,你是对的,但我无法查看代码,该站点是从这个 openurl.php 页面调用实际的 openurl 函数。
    【解决方案2】:

    您可以通过此 HTML 代码在一个页面中打开无限的 url。尝试将以下代码粘贴到 html 网页中。

    <iframe src="http://yahoo.com" height="50%" width="49%" ></iframe>
    <iframe src="http://yahoo.com" height="50%" width="49%" ></iframe>
    <iframe src="http://yahoo.com/m" height="50%" width="49%" ></iframe>
    <iframe src="http://yahoo.com/m" height="50%" width="49%" ></iframe>
    

    注意:google.com 和其他一些网站可能不允许在框架中打开其网站网址。

    【讨论】:

    • 这对我来说是一个很好的解决方案。我需要一些脚本来运行,并且能够在一页中将数千个 IFRAME 排队,而不会杀死服务器。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-27
    • 2021-12-07
    • 1970-01-01
    • 1970-01-01
    • 2020-04-21
    相关资源
    最近更新 更多