note 124279 added to book.exec
| From: | bishop@php.net | Date: | Wed, 09 Oct 2019 14:07:33 +0000 |
| Subject: | note 124279 added to book.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212563@lists.php.net to get a copy of this message | ||
There is also the backtick ("back-tick") execution operator:
https://www.php.net/manual/en/language.operators.execution.php
<?php
$output =
ls -al;
echo "<pre>$output</pre>";
?>
This operator runs the command given inside the backticks, and supports string interpolation just
like double quotes:
<?php
$host = 'example.com';
echo ping -n 3 {$host};
?>
Backticks have no special meaning inside of double quotes:
<?php
echo "I said ls to you!"; # outputs: I said ls to you!
?>
Since this operator runs a command on your system, and accepts variables, you must be very careful
to sanitize input and understand what's being run -- don't use it lightly. The same can be
said of the execution functions in this chapter.
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.157.54 (proxied: 96.10.213.43)
----
Manual Page -- http://php.net/manual/en/book.exec.php
Edit -- https://master.php.net/note/edit/124279
Del: integrated -- https://master.php.net/note/delete/124279/integrated
Del: useless -- https://master.php.net/note/delete/124279/useless
Del: bad code -- https://master.php.net/note/delete/124279/bad+code
Del: spam -- https://master.php.net/note/delete/124279/spam
Del: non-english -- https://master.php.net/note/delete/124279/non-english
Del: in docs -- https://master.php.net/note/delete/124279/in+docs
Del: other reasons-- https://master.php.net/note/delete/124279
Reject -- https://master.php.net/note/reject/124279
Search -- https://master.php.net/manage/user-notes.php