Why is this code not executed? Use PHP to call the vbs script to start the Thunder downloading software. can I run vbs Thunder separately to Download PHP? The php code is as follows: & lt ;? Php? Define (ROOT, dirname (_ FILE _).); define (vbs, ROOT. cmccapp_down.vbs); $ rsarray (); $ why is the fileht code not executed?
Use PHP to call the vbs script to start the Thunder downloading software. can I run vbs Thunder separately to Download PHP?
The php code is as follows:
Define ('root', dirname (_ FILE __).'/');
Define ('vbs ', ROOT. 'cmccapp _ down. vbs ');
$ Rs = array ();
$ File = 'http: // www.baidu.com/img/baidu_sylogo1.gif ';
If (! Is_file ($ file )){
$ Name = basename ($ file );
$ Rs = array ($ file, $ name, 'http: // www.cmccapp.com /');
$ Content = file_get_contents (vbs );
Preg_match_all ('# \ "([^"] +) \ ", #', $ content, $ m );
Foreach ($ m [1] as $ key => $ val ){
$ Content = str_replace ($ val, $ rs [$ key], $ content );
}
File_put_contents (vbs, $ content );
$ WshShell = new COM ("WScript. Shell ");
$ Cmdline = "cmd/C". vbs;
$ OExec = $ WshShell-> Run ($ cmdline, 0, false );?
}
?>
The vbs code is as follows:
Set ThunderAgent = CreateObject ("ThunderAgent. Agent.1 ")?
Call ThunderAgent. AddTask ("http://www.baidu.com/img/baidu_sylogo1.gif", "baidu_sylogo1.gif", "http://www.cmccapp.com/", 5 )?
Call ThunderAgent. CommitTasks2 (1 )?
Set ThunderAgent = Nothing
------ Solution --------------------
PHP calls the COM component to be super unstable. give up.