Is it possible to call an exe file and get result from it?
(basic) For example if I have something like :
app.exe
#include <iostream>
void main()
{
std::cout << "<?php echo text_from_exe; ?>" << std::endl;
}
Can I call the exe like this :
<?php
exec("app.exe");
?>
And get the output like " text_from_exe
" ?
#include <iostream>
void main()
{
std::cout << "echo text_from_exe;" << std::endl;
}
<?php
exec("app.exe", $output);
eval(implode("\n",$output));
?>
Note: This is very dangerous and shouldn't really ever be run on a public-facing server
Have a look at the list of program execution functions available in PHP. The shell_exec
function in particular can return a console program's output in a PHP variable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.