php命令行(CLI)参数详解
PHP作为一门web开发语言,通常情况下我们都是在Web Server中运行PHP,使用浏览器访问,因此很少关注其命令行操作以及相关参数的使用,但是,特别是在类Unix操作系统上,PHP可以作为一门脚本语言执行与shell类似的处理任务。php命令行(CLI)参数详解
查看PHP的所有命令行参数,使用php -h命令。我们将会对大部分常用的命令行参数进行一一解释,以加深对PHP能力的认识,更加快捷的在服务端命令行下使用PHP或者调试各种因为对环境不熟悉而出现的问题。
#php -h
Usage: php [options] [-f] <file> [--] [args...]
php [options] -r <code> [--] [args...]
php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
php [options] -S <addr>:<port> [-t docroot]
php [options] -- [args...]
php [options] -a
-a Run as interactive shell
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-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
-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 <addr>:<port> Run with built-in web server.
-t <docroot> Specify document root <docroot> for built-in web server.
-s Output HTML syntax highlighted source.
-v Version number
-w Output source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
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>.
--rz <name> Show information about Zend extension <name>.
--ri <name> Show configuration for extension <name>.
-a 以交互式shell模式运行
-c | 指定php.ini文件所在的目录
-n 指定不使用php.ini文件
-d foo[=bar] 定义一个INI实体,key为foo,value为'bar'
-e 为调试和分析生成扩展信息
-f 解释和执行文件.
-h 打印帮助
-i 显示PHP的基本信息
-l 进行语法检查 (lint)
-m 显示编译到内核的模块
-r 运行PHP代码,不需要使用标签 ..?>
-B 在处理输入之前先执行PHP代码
-R 对输入的没一行作为PHP代码运行
-F Parse and execute for every input line
-E Run PHP after processing all input lines
-H Hide any passed arguments from external tools.
-S : 运行内建的web服务器.
-t 指定用于内建web服务器的文档根目录
-s 输出HTML语法高亮的源码
-v 输出PHP的版本号
-w 输出去掉注释和空格的源码
-z 载入Zend扩展文件 .
args... 传递给要运行的脚本的参数. 当第一个参数以-开始或者是脚本是从标准输入读取的时候,使用--参数
--ini 显示PHP的配置文件名
--rf 显示关于函数 的信息.
--rc 显示关于类 的信息.
--re 显示关于扩展 的信息.
--rz 显示关于Zend扩展 的信息.
--ri 显示扩展 的配置信息.
热门日志
分类
- Django(4)
- ssdb(1)
- Mac(7)
- C(1)
- memcache(1)
- Python(32)
- Vim(8)
- sed(2)
- ansible(3)
- awk(4)
- shell(3)
- about(1)
- git(9)
- bat(4)
- svn(0)
- docker(1)
- Tornado(1)
- go(2)
- 架构(18)
- Vue(1)
- game(2)
- Html(6)
- Java(8)
- Mysql(37)
- Ajax(2)
- Jsp(1)
- Struts(8)
- Linux(72)
- JavaScript(39)
- Staruml(0)
- Mouth(1)
- Php(102)
- Windows(8)
- Message(48)
- Lua(10)
- Compute(1)
- Redis(7)
- Nginx(12)
- Jquery(1)
- Apache(1)
- cocos2d-x(8)