mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- Sync with latest commits to php_cgi.c .
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@84861 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
fc91ce2880
commit
e084644997
1 changed files with 60 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<chapter id="features.commandline">
|
||||
<title>Using PHP from the command line</title>
|
||||
<!-- NEW DOCUMENTATION STARTS -->
|
||||
|
@ -110,6 +110,65 @@
|
|||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The ease the operating in the shell environment, the following constants
|
||||
are defined:
|
||||
<table>
|
||||
<title>CLI specific Constants</title>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Constant</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><constant>STDIN</constant></entry>
|
||||
<entry>
|
||||
An already opened stream to <literal>stdin</literal>. This saves
|
||||
opening it with
|
||||
<programlisting role="php">
|
||||
$stdin = fopen('php://stdin', 'r');
|
||||
</programlisting>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>STDOUT</constant></entry>
|
||||
<entry>
|
||||
An already opened stream to <literal>stdout</literal>. This saves
|
||||
opening it with
|
||||
<programlisting role="php">
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
</programlisting>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>STDERR</constant></entry>
|
||||
<entry>
|
||||
An already opened stream to <literal>stdout</literal>. This saves
|
||||
opening it with
|
||||
<programlisting role="php">
|
||||
$stderr = fopen('php://stderr', 'w');
|
||||
</programlisting>
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
<para>
|
||||
Given the above, you don't need to open e.g. a stream for
|
||||
<literal>stderr</literal> yourself but simply use the constant instead of
|
||||
the stream resource:
|
||||
<programlisting role="php">
|
||||
php -r 'fwrite(STDERR, "stderr\n");'
|
||||
</programlisting>
|
||||
You do not need to explicitely close these streams, this is automatically
|
||||
done by <literal>PHP</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The <literal>CLI SAPI</literal> does <emphasis
|
||||
|
|
Loading…
Reference in a new issue