⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 features.commandline.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
📖 第 1 页 / 共 4 页
字号:
     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-n</td>      <td colspan="1" rowspan="1" align="left">--no-php-ini</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        Ignore <var class="filename">php.ini</var> at all. This switch is available since PHP 4.3.0.       </p>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-d</td>      <td colspan="1" rowspan="1" align="left">--define</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        This option allows you to set a custom value for any of the configuration        directives allowed in <var class="filename">php.ini</var>. The syntax is:        <div class="example-contents"><pre><div class="cdata"><pre>-d configuration_directive[=value]</pre></div>        </pre></div>       </p>       <p class="para"><div class="informalexample">        <p class="para">         Examples (lines are wrapped for layout reasons):        </p>        <div class="example-contents"><pre><div class="cdata"><pre># Omitting the value part will set the given configuration directive to &quot;1&quot;$ php -d max_execution_time        -r &#039;$foo = ini_get(&quot;max_execution_time&quot;); var_dump($foo);&#039;string(1) &quot;1&quot;# Passing an empty value part will set the configuration directive to &quot;&quot;php -d max_execution_time=        -r &#039;$foo = ini_get(&quot;max_execution_time&quot;); var_dump($foo);&#039;string(0) &quot;&quot;# The configuration directive will be set to anything passed after the &#039;=&#039; character$  php -d max_execution_time=20        -r &#039;$foo = ini_get(&quot;max_execution_time&quot;); var_dump($foo);&#039;string(2) &quot;20&quot;$  php        -d max_execution_time=doesntmakesense        -r &#039;$foo = ini_get(&quot;max_execution_time&quot;); var_dump($foo);&#039;string(15) &quot;doesntmakesense&quot;</pre></div>        </pre></div>       </div></p>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-e</td>      <td colspan="1" rowspan="1" align="left">--profile-info</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        Activate the extended information mode, to be used by a        debugger/profiler.       </p>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-f</td>      <td colspan="1" rowspan="1" align="left">--file</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        Parses and executes the given filename to the <span class="option">-f</span>        option. This switch is optional and can be left out. Only providing        the filename to execute is sufficient.       </p>       <blockquote><p><b class="note">Note</b>:                  To pass arguments to scripts the first argument needs to be         <i>--</i>, otherwise PHP will interperate them as PHP         options.        <br />       </p></blockquote>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-h and -?</td>      <td colspan="1" rowspan="1" align="left">--help and --usage</td>      <td colspan="1" rowspan="1" align="left">       With this option, you can get information about the actual list of       command line options and some one line descriptions about what they do.      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-i</td>      <td colspan="1" rowspan="1" align="left">--info</td>      <td colspan="1" rowspan="1" align="left">       This command line option calls <a href="function.phpinfo.html" class="function">phpinfo()</a>, and prints       out the results. If PHP is not working correctly, it is       advisable to use <strong class="command">php -i</strong> and see whether any error       messages are printed out before or in place of the information tables.       Beware that when using the CGI mode the output is in <i>HTML</i>        and therefore quite huge.      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-l</td>      <td colspan="1" rowspan="1" align="left">--syntax-check</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        This option provides a convenient way to only perform a syntax check        on the given PHP code. On success, the text        <i>No syntax errors detected in &lt;filename&gt;</i> is        written to standard output and the shell return code is        <i>0</i>. On failure, the text <i>Errors parsing        &lt;filename&gt;</i> in addition to the internal parser error        message is written to standard output and the shell return code is set        to <i>255</i>.       </p>       <p class="para">        This option won&#039;t find fatal errors (like undefined functions). Use        <span class="option">-f</span> if you would like to test for fatal errors too.       </p>       <blockquote><p><b class="note">Note</b>:                  This option does not work together with the <span class="option">-r</span>         option.        <br />       </p></blockquote>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-m</td>      <td colspan="1" rowspan="1" align="left">--modules</td>      <td colspan="1" rowspan="1" align="left">       <p class="para"><div class="informalexample">        <p class="para">         Using this option, PHP prints out the built in (and loaded) PHP and         Zend modules:        </p>        <div class="example-contents"><pre><div class="cdata"><pre>$ php -m[PHP Modules]xmltokenizerstandardsessionposixpcreoverloadmysqlmbstringctype[Zend Modules]</pre></div>        </pre></div>       </div></p>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-r</td>      <td colspan="1" rowspan="1" align="left">--run</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        This option allows execution of PHP right from        within the command line. The PHP start and end tags        (<i>&lt;?php</i> and <i>?&gt;</i>) are        <em class="emphasis">not needed</em> and will cause a parser        error if present.       </p>       <blockquote><p><b class="note">Note</b>:                  Care has to be taken when using this form of PHP         to not collide with command line variable substitution done by the         shell.        <br />        <div class="informalexample">         <p class="para">          Example showing a parser error         </p>         <div class="example-contents"><pre><div class="cdata"><pre>$ php -r &quot;$foo = get_defined_constants();&quot;Command line code(1) : Parse error - parse error, unexpected &#039;=&#039;</pre></div>         </pre></div>        </div>                 The problem here is that the sh/bash performs variable substitution         even when using double quotes <i>&quot;</i>. Since the         variable <var class="varname">$foo</var> is unlikely to be defined, it         expands to nothing which results in the code passed to         PHP for execution actually reading:        <br />        <div class="informalexample">         <div class="example-contents"><pre><div class="cdata"><pre>$ php -r &quot; = get_defined_constants();&quot;</pre></div>         </pre></div>         <p class="para">         The correct way would be to use single quotes <i>&#039;</i>.         Variables in single-quoted strings are not expanded         by sh/bash.         </p>         <div class="example-contents"><pre><div class="cdata"><pre>$ php -r &#039;$foo = get_defined_constants(); var_dump($foo);&#039;array(370) {  [&quot;E_ERROR&quot;]=&gt;  int(1)  [&quot;E_WARNING&quot;]=&gt;  int(2)  [&quot;E_PARSE&quot;]=&gt;  int(4)  [&quot;E_NOTICE&quot;]=&gt;  int(8)  [&quot;E_CORE_ERROR&quot;]=&gt;  [...]</pre></div>         </pre></div>        </div>                 If you are using a shell different from sh/bash, you might experience         further issues. Feel free to open a bug report at         <a href="http://bugs.php.net/" class="link external">&raquo; http://bugs.php.net/</a>.         One can still easily run into troubles when trying to get shell         variables into the code or using backslashes for escaping. You&#039;ve         been warned.        <br />       </p></blockquote>       <blockquote><p><b class="note">Note</b>:                  <span class="option">-r</span> is available in the <em class="emphasis">CLI</em>         SAPI and not in the <em class="emphasis">CGI</em> SAPI.        <br />       </p></blockquote>       <blockquote><p><b class="note">Note</b>:                  This option is meant for a very basic stuff. Thus some configuration         directives (e.g. <a href="ini.core.html#ini.auto-prepend-file" class="link">auto_prepend_file</a> and <a href="ini.core.html#ini.auto-append-file" class="link">auto_append_file</a>) are ignored         in this mode.        <br />       </p></blockquote>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-B</td>      <td colspan="1" rowspan="1" align="left">--process-begin</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        PHP code to execute before processing stdin. Added in PHP 5.       </p>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-R</td>      <td colspan="1" rowspan="1" align="left">--process-code</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        PHP code to execute for every input line. Added in PHP 5.       </p>       <p class="para">        There are two special variables available in this mode:        <var class="varname">$argn</var> and <var class="varname">$argi</var>.        <var class="varname">$argn</var> will contain the line PHP is processing at        that moment, while <var class="varname">$argi</var> will contain the line        number.       </p>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-F</td>      <td colspan="1" rowspan="1" align="left">--process-file</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        PHP file to execute for every input line. Added in PHP 5.       </p>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-E</td>      <td colspan="1" rowspan="1" align="left">--process-end</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        PHP code to execute after processing the input. Added in PHP 5.       </p>       <p class="para"><div class="example">        <p><b>Example #2 Using the <span class="option">-B</span>, <span class="option">-R</span> and         <span class="option">-E</span> options to count the number of lines of a         project.        </b></p>        <div class="example-contents"><pre><div class="cdata"><pre>$ find my_proj | php -B &#039;$l=0;&#039; -R &#039;$l += count(@file($argn));&#039; -E &#039;echo &quot;Total Lines: $l\n&quot;;&#039;Total Lines: 37328</pre></div>        </pre></div>       </div></p>      </td>     </tr>     <tr valign="middle">      <td colspan="1" rowspan="1" align="left">-s</td>      <td colspan="1" rowspan="1" align="left">--syntax-highlight and --syntax-highlight</td>      <td colspan="1" rowspan="1" align="left">       <p class="para">        Display colour syntax highlighted source.       </p>       <p class="para">        This option uses the internal mechanism to parse the file and produces        a <i>HTML</i> highlighted version of it and writes it to        standard output. Note that all it does it to generate a block of        <i>&lt;code&gt; [...] &lt;/code&gt;</i>        <i>HTML</i> tags, no <i>HTML</i> headers.       </p>       <blockquote><p><b class="note">Note</b>:                  This option does not work together with the <span class="option">-r</span>         option.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -