首页 \ 问答 \ 如何使用PHP从浏览器启动应用程序?(How to launch an application from the browser using PHP?)

如何使用PHP从浏览器启动应用程序?(How to launch an application from the browser using PHP?)

我在我的linux机器上使用wine安装了.exe文件。 使用shell_exec我可以使用php通过命令提示符启动exe文件。 当我尝试从浏览器运行php程序时,我得到一个空白页面。 如何使用php从浏览器启动可执行文件?

而且,使用ip地址我应该能够在安装在一个系统中的其他系统浏览器中启动。

php代码:

<?php

shell_exec("cd / ; wine /home/quads/.wine/drive_c/Program\ Files/MathType/MathType.exe");
?>

如果我通过命令提示符运行它,它可以通过浏览器启动应用程序
它不起作用。它通过浏览器工作,然后我可以使用其他系统访问该应用程序
myipaddress/phpprogram


I have installed .exe file using wine in my linux machine. Using shell_exec I could launch the exe file via command prompt using php. When I try to run php program from the browser am getting a blank page. How to launch the executables from the browser using php?

And also, using ip address I should be able to launch in other system browser which is installed in one system.

php code:

<?php

shell_exec("cd / ; wine /home/quads/.wine/drive_c/Program\ Files/MathType/MathType.exe");
?>

If I run this through command prompt it could launch an application but via browser it
doesn't work.It it works via browser then I can access that application from other system using
myipaddress/phpprogram


原文:https://stackoverflow.com/questions/27819470
更新时间:2023-11-25 17:11

最满意答案

n3376 5.2.10 / 6

函数指针可以显式转换为不同类型的函数指针。 通过指向函数类型(8.3.5)的函数调用函数的效果是未定义的,该函数类型与函数定义中使用的类型不同。 除了将“指向T1的指针”类型的prvalue转换为“指向T2的指针”类型(其中T1和T2是函数类型)并返回其原始类型产生原始指针值之外,这种指针转换的结果未指定。


n3376 5.2.10/6

A function pointer can be explicitly converted to a function pointer of a different type. The effect of calling a function through a pointer to a function type (8.3.5) that is not the same as the type used in the definition of the function is undefined. Except that converting a prvalue of type “pointer to T1” to the type “pointer to T2” (where T1 and T2 are function types) and back to its original type yields the original pointer value, the result of such a pointer conversion is unspecified.

相关问答

更多
  • 您确实传递了不兼容的指针类型。 strings1是指向字符的2D指针数组。 注意,C中的2D数组元素按行顺序排列,而函数期望在ProcessStrings内第一次取消引用strings1之后看到指针。 如果希望代码正常工作,则需要将以下构造传递给ProcessStrings char **strings2[] = { strings1[0], strings1[1], strings2[2] }; 或者更改函数以使用指向100个char指针数组的指针: vo ...
  • 你可以这样做: var FormMethod: TFormMethod; ComponentMethod: TComponentMethod; begin FormMethod := M2; ComponentMethod := TComponentMethod(FormMethod); end; 据我所见,诀窍是你需要分配一个临时的局部变量,然后将其分配给ComponentMethod 。 如你所知,这不是类型安全的。 如果使用不是从TForm派生的参数调用ComponentMethod ...
  • 在设计高级语言的范例时可以避免使用指针 - 例如以java为例 - 但它们往往会在语言声称提供的功能的实际实现中再次出现。 除非您使用某种动态重新配置FPGA架构,状态机群或与您的计算机类似的想法,否则实际的计算机器不是非常面向对象的。 我们不在存储设备中执行操作,而是获取数据,对其进行计算并将其写回。 为了在内存中查找数据,我们使用地址的概念(存在称为内容可寻址存储器的东西,但是对于大多数目的而言,它们不是优选的)。 一旦您确定您的数据(或函数体或包含两者的结构)在某个地址的内存中,您就必须弄清楚如何处理 ...
  • 架构不需要将代码和数据存储在同一个内存中。 使用哈佛架构,代码和数据存储在完全不同的内存中。 大多数架构是Von Neumann架构,其代码和数据在同一个内存中,但C并不仅限于某些类型的架构,如果可能的话。 An architecture doesn't have to store code and data in the same memory. With a Harvard architecture, code and data are stored in completely different me ...
  • n3376 5.2.10 / 6 函数指针可以显式转换为不同类型的函数指针。 通过指向函数类型(8.3.5)的函数调用函数的效果是未定义的,该函数类型与函数定义中使用的类型不同。 除了将“指向T1的指针”类型的prvalue转换为“指向T2的指针”类型(其中T1和T2是函数类型)并返回其原始类型产生原始指针值之外,这种指针转换的结果未指定。 n3376 5.2.10/6 A function pointer can be explicitly converted to a function pointer ...
  • 对于包含函数指针的数组(或其他数据结构),有各种各样的用例。 通常,这种类型的机制允许程序根据运行时标准动态调用几个不同的函数之一。 例如,您可以使用一组函数指针来实现类似于OO语言的接口。 该数组将持有指向该接口的每个实现的指针。 根据某些标准,数组索引将用于选择所需的实现。 There are a variety of use cases for arrays (or other data structures) holding function pointers. Generally, that ty ...
  • 从C99标准第6.7.5.1节第2段: 要使两个指针类型兼容,两者都应具有相同的限定条件,并且两者都应是兼容类型的指针。 在您的情况下,函数指针不兼容,因为返回值不兼容。 所以,是的,你必须在调用指向函数之前强制转换。 From the C99 standard section 6.7.5.1, paragraph 2: For two pointer types to be compatible, both shall be identically qualified and both shall be ...
  • 只要您小心保持您的呼叫类型正确,这是完成您描述的相当C语言的方式。 As long as you are careful to keep your calls type-correct, this is a fairly C-idiomatic way to accomplish what you describe.
  • TL; DR “功能”和“功能指针”是相同的。 有一个指针的概念,以及它的用法语法; 目前尚不清楚你在问什么。 概念 指向函数的指针可能与函数本身不同(差异在c ++中没有用 - 见下文),因为函数可能占用很多空间 - 它的代码可能是任意复杂的。 操作(例如复制或搜索/修改)函数的代码很少有用,因此c / c ++根本不支持它。 如果要修改函数的代码,请将指针转换为char* ,应用所有必要的预防措施(我从未这样做过)。 因此,如果您正在编写C语言,那么您只需要指向函数。 然而... 句法 如果你有一个函数 ...
  • 静态类函数和具有相同参数和结果类型的普通函数之间的二进制级别没有区别 - 它们是二进制兼容的,因此您的示例是可以的。 当然,它们是编译器的不同类型,所以您需要Addr()或@来编译您的示例。 Addr()等同于@运算符,除了它不受$ T编译器指令的影响。如果你切换类型检查你的例子将无法编译: {$T+} begin CallIt(@TMyClass.StaticMethod); Readln; end. [Pascal Error] Project10.dpr(28):E2010不兼容的类型:'T ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)