如何使用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 usingmyipaddress/phpprogram
原文:https://stackoverflow.com/questions/27819470
最满意答案
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.
相关问答
更多-
指针上的指针(Pointers On Pointers)[2022-03-29]
您确实传递了不兼容的指针类型。 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 ...
-
我们需要指针吗?(Do we need pointers?)[2021-10-17]
在设计高级语言的范例时可以避免使用指针 - 例如以java为例 - 但它们往往会在语言声称提供的功能的实际实现中再次出现。 除非您使用某种动态重新配置FPGA架构,状态机群或与您的计算机类似的想法,否则实际的计算机器不是非常面向对象的。 我们不在存储设备中执行操作,而是获取数据,对其进行计算并将其写回。 为了在内存中查找数据,我们使用地址的概念(存在称为内容可寻址存储器的东西,但是对于大多数目的而言,它们不是优选的)。 一旦您确定您的数据(或函数体或包含两者的结构)在某个地址的内存中,您就必须弄清楚如何处理 ... -
为什么C / C ++中的函数指针和数据指针不兼容?(Why are function pointers and data pointers incompatible in C/C++?)[2023-07-10]
架构不需要将代码和数据存储在同一个内存中。 使用哈佛架构,代码和数据存储在完全不同的内存中。 大多数架构是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 ...
-
使用函数指针数组(Use of array of function pointers)[2022-08-09]
对于包含函数指针的数组(或其他数据结构),有各种各样的用例。 通常,这种类型的机制允许程序根据运行时标准动态调用几个不同的函数之一。 例如,您可以使用一组函数指针来实现类似于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语言,那么您只需要指向函数。 然而... 句法 如果你有一个函数 ...
-
静态类方法和常规例程指针的兼容性如何?(How compatible are static class methods and regular routine pointers?)[2021-12-15]
静态类函数和具有相同参数和结果类型的普通函数之间的二进制级别没有区别 - 它们是二进制兼容的,因此您的示例是可以的。 当然,它们是编译器的不同类型,所以您需要Addr()或@来编译您的示例。 Addr()等同于@运算符,除了它不受$ T编译器指令的影响。如果你切换类型检查你的例子将无法编译: {$T+} begin CallIt(@TMyClass.StaticMethod); Readln; end. [Pascal Error] Project10.dpr(28):E2010不兼容的类型:'T ...