我想把批处理文件链接到按钮怎么做... [英] I am tring to link batch file to button how do it...

查看:80
本文介绍了我想把批处理文件链接到按钮怎么做...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是php新手。我正在为open vlc应用程序创建一个批处理文件。现在我想将此批处理文件链接到按钮。因此,点击按钮后,vlc应用程序就会运行。



我尝试了什么:



我正在创建一个批处理文件,我在这个函数中运行函数runbat(),我给出了一个vlc的路径。并且在onclick中的Html中给出了这个函数。

解决方案

这是按钮点击时执行PHP代码的多种解决方案。我认为这个SO线程涵盖了所有这些:

使用onClick执行PHP功能 - Stack Overflow [ ^ ]



要执行批处理文件,请使用 PHP:exec - 手册 [ ^ ]功能。它将启动 cmd.exe ,在使用其他功能时必须指定,如 system()

  //  使用exec()启动cmd.exe  
exec(

path_to_batch_file);
// 使用需要为批处理文件指定cmd.exe的系统
system ( cmd / c


path_to_batch_file);



请注意,PHP代码在服务器上执行,因此您只能在服务器上执行批处理文件。没有方法可以通过网页在客户端上启动批处理文件。


I am new in php. i am creating a batch file for open vlc application. Now i want to link this batch file to button. So after click on button the vlc application is run.

What I have tried:

L am creating a batch file and i html crate the function runbat() in this function i am giving a path of vlc. And in Html in onclick m giving this function.

解决方案

Thre are multiple solutions to execute PHP code upon a button click. I think this SO thread covers them all:
Execute PHP function with onClick - Stack Overflow[^]

To execute a batch file use the PHP: exec - Manual[^] function. It will start cmd.exe which must be specified when using other functions like system():

// Using exec() which starts cmd.exe
exec(


path_to_batch_file); // Using system which requires specifying cmd.exe for batch files system("cmd /c


path_to_batch_file");


Note that PHP code is executed on the server and you can therefore only execute batch files on the server. There is no method to initiate executing batch files on a client by a web page.


这篇关于我想把批处理文件链接到按钮怎么做...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆