Hướng dẫn php button onclick shell_exec
I have google the heck out of this an I cannot get an answer to this. I hate php, but out php guy is too busy and I need HELP! I want to call a perl script from an html button. But, I just want it to run in the back ground, I don't need to display anything from it... Would something like this work?
I would prefer not to use cgi, I want to keep this as simple as possible. Thanks asked Sep 24, 2011 at 18:01
JonnyCplusplusJonnyCplusplus 8813 gold badges11 silver badges22 bronze badges 2 That will not works, you have to create an action for that:
answered Sep 24, 2011 at 18:09
0
Looks like you are trying to call PHP with a JavaScript action. This will not work. You can try submitting a form and executing the PHP code when the form is submitted, like:
answered Sep 24, 2011 at 18:06
Rusty FausakRusty Fausak 7,2051 gold badge27 silver badges38 bronze badges Addressing the 'run in background' part of this problem, you should be able to put an & at the end to force it to the background. So exec('test.pl &'); answered Sep 25, 2011 at 3:23
nicknick 2,0662 gold badges13 silver badges14 bronze badges (PHP 4, PHP 5, PHP 7, PHP 8) exec — Execute an external program Descriptionexec(string Parameterscommand The command that will be executed. output If the result_code If the Return ValuesThe last line from the result of the command. If you need to execute a command and have all the data from the command passed directly back without any interference, use the passthru() function. Returns To get the output of the executed command, be sure to set and use
the ExamplesExample #1 An exec() example
The above example will output something similar to: Returned with status 0 and output: Array ( [0] => cmb ) NotesWarning When allowing user-supplied data to be passed to this function, use escapeshellarg() or escapeshellcmd() to ensure that users cannot trick the system into executing arbitrary commands.
See Also
Arno van den Brink ¶ 13 years ago
dell_petter at hotmail dot com ¶ 13 years ago
__construct($cl=false){ Simon ¶ 7 years ago
krjdev at gmail dot com ¶ 11 months ago
msheakoski @t yahoo d@t com ¶ 18 years ago
ivk ¶ 1 year ago
Farhad Malekpour ¶ 15 years ago
Paul Sommer ¶ 6 years ago
Bob-PHP at HamsterRepublic dot com ¶ 16 years ago
hans at internit dot NO_SPAM dot com ¶ 20 years ago
layton at layton dot tk ¶ 17 years ago
elwiz at 3e dot pl ¶ 12 years ago
(); juan at laluca dot com ¶ 11 years ago
php dot reg at kjpetrie dot co dot uk ¶ 1 month ago
alvaro at demogracia dot com ¶ 11 years ago
Hypolite Petovan ¶ 2 years ago
Martin Lakes ¶ 11 years ago
bahri at bahri dot info ¶ 13 years ago
$pid === false )
dr_jones153 at hotmail dot com ¶ 14 years ago
|