[args...]
php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--]
[args...]
php [options] -- [args...]
php [options] -a
-a Run interactively交互运行
-c <path>|<file> Look for php.ini file in this directory在这个目录寻找php.ini文件
-n No php.ini file will be used不使用php.ini文件
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse and execute <file>.
-h This help
-i PHP information类似phpinfo()函数
-l Syntax check only (lint)
-m Show compiled in modules
-r <code> Run PHP <code> without using script tags <?..?>直接运行代码。双引号包围,分号结尾
-B <begin_code> Run PHP <begin_code> before processing input lines
-R <code> Run PHP <code> for every input line
-F <file> Parse and execute <file> for every input line
-E <end_code> Run PHP <end_code> after processing all input lines
-H Hide any passed arguments from external tools.
-s Display colour syntax highlighted source.高亮显示代码
-v Version number版本信息
-w Display source with stripped comments and whitespace.去除注释和空白后显示源代码
-z <file> Load Zend extension <file>.加载ZEND扩展
args... Arguments passed to script. Use -- args when first
argument
starts with - or script is read from stdin
--ini Show configuration file names
--rf <name> Show information about function <name>.显示一个函数的原型描述
--rc <name> Show information about class <name>.显示类的描述
--re <name> Show information about extension <name>.显示对扩展的描述
--ri <name> Show configuration for extension <name>.显示扩展配置信息
需要注意的是CLI模式和CGI模式运行时用的PHP.INI并非同一套配置,需要单独配置。
<?php
if(!defined("STDIN")) {
define("STDIN", fopen('php://stdin','r'));
}
//php5.2里面STDIN已经定义了
echo "Hello! What is your name (enter below):\n";
$strName = fread(STDIN, 80);
echo 'Hello ',$strName, "\n";
?>
>php --rf print_r#查看函数
输出
Function [ <internal:standard> function print_r ] {