我想用 php 调用 火狐打开一个网页面在cmd:执行 "d:\Program Files\Mozilla Firefox\firefox.exe" http://localhost/ppp.html  这个是可以使用的。我想用 php 调用它。<?php
exec("d:/Program Files/Mozilla Firefox/firefox.exe http://localhost/ppp.html");
?>这个代码不起作用,我想请问,得怎么处理?是权限问题?还是安全问题,要怎么设置??问题解决,有多少分给多少分。

解决方案 »

  1.   

    没用过这函数,刚去手册上查了下,'c:\\WINDOWS\\system32\\psexec.exe \\192.168.1.224 -u myuser -p mypassword -accepteula cacls c:\\documents\\RRHH &amp;&amp; exit'  路径要\\  希望对你有帮助
      

  2.   

    谢谢,li_star !exec("d:\\Program Files\\Mozilla Firefox\\firefox.exe http://localhost/ppp.html");这样依旧不能用!
      

  3.   

    还有个要和你说下的是
    string exec ( string $command [, array &$output [, int &$return_var ]] )第一个参数 The command that will be executed. 第一个是参数是cmd命令
      

  4.   

    你是在apache/iis等web服务器的php里运行吗?恐怕是根本不可行的。
    如果是基于cli的,或许还有一线希望。
      

  5.   

    参考:http://topic.csdn.net/u/20120619/12/b812046e-eeef-419b-9626-84d838615eb7.html
      

  6.   

    exec("cd d:/Program Files/Mozilla Firefox/firefox.exe http://localhost/ppp.html");
      

  7.   

    exec("cd d:/Program Files/Mozilla Firefox/firefox.exe http://localhost/ppp.html");=-=-=
    这个不行
      

  8.   

    这是不可以的
    php 的 exec、system等函数都是在后台运行的,不可能出现窗口界面另外php是在服务器上运行的,虽然你是在一台机器上调试,但也应该把它看做是两台机器
    即便用exec能够出现窗口,你也不可能跑到服务器上去操作。
      

  9.   

    windows下尝试
    控制面板 > 管理工具 > 服务 > 找到apache > 右键属性 > 登录 > 允许服务与桌面交互打上勾
      

  10.   

    请参考:首先建立vbs文件:Set oword = CreateObject("Word.Application")
    Set ws = CreateObject("wscript.shell")
    ws.Run("http://目标页面.php")
    WScript.Sleep 2000
    For Each task in oword.Tasks 
      If InStr(task.name, "页面title") Then ok = "a" 
    Next
    If ok <> "a" Then ws.Run("http://www.baidu.com")
    oWord.Quit
    Set oword = Nothing
    Set ws = Nothing 
    再编写php执行页面:<html>
    <head>
    <title>页面title</title>
    </head>
    <body>
    <?php
    //$thisday = date("ymd", strtotime("-1 day"));
    $thisday = date("Ymd");
    system("cmd /c D:/path/backup/mysqldump -h localhost -u用户名 -p密码 数据库名>\"D:/path/dbbakup/保存的数据库文件名_".$thisday.".sql\""); 
    ?>
    </body>
    <script language="javascript">
    <!--
    function clock(){i=i-1
    window.opener = null; 
    window.open("","_self");
    if(i>0)setTimeout("clock();",1000);
    else self.close();}
    var i=10
    clock();
    //-->
    </script>
    </html> 
    最后将*.vbs文件用windows的计划任务来调用。