开发者

How to convert .bat code to .php code

I want use webscreencapture to make a web screenshot. if I save the below code in a screenshot.bat, and then click it, it can catch the two web screenshots.

webscreencapture.exe http://www.youtube.com/watch?v=SLyG0mUnw4A e:\www\111\1.jpg
webscreencapture.exe http://www.youtube.com/watch?v=izUxI-k01CU e:\www\111\2.jpg

Now I want to convert .bat code to .php code. I use:

<?php
$cmd = 'webscreencapture.ex开发者_Go百科e http://www.youtube.com/watch?v=SLyG0mUnw4A e:\www\111\1.jpg';
sleep(1);
$cmd = 'webscreencapture.exe http://www.youtube.com/watch?v=izUxI-k01CU e:\www\111\1.jpg';
system($cmd);
?>

It just gets the second web screenshot. It doesn't seem to run the first command. Where's the problem? Thanks.

By the way, webscreencapture can not set a time delay, and can not screenshot a youtube movie. Can anyone recommend something that can?


You don't execute your first $cmd. You just replace it after sleeping for a second.


Your assigning cmd to the new string before even calling the first command. Also, the filenames appear to be the same.


You never actually bother ever calling the first command. You have to call system($cmd) after assigning the variable.


Well, the main problem seems to be that you only call system($cmd) once.

$cmd is just a variable that contains the command to call. The system($cmd) is what actually executes it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜