php cli 参数

WBOY
WBOYOriginal
2016-06-23 14:34:581208browse

发现脚本中 /user/bin/php -qd open_dir=/

查手册,d  define,用该参数可以自行设置任何可以在 php.ini 文件中设置的配置选项的值,其语法为:

-d configuration_directive[=value] # 取值部分被省略,将会把配置选项设为 "1"
$ php -d max_execution_time -r '$foo = ini_get("max_execution_time"); var_dump($foo);' string(1) "1"
# 取值部分为空白,将会把配置选项设为 ""
php -d max_execution_time= -r '$foo = ini_get("max_execution_time"); var_dump($foo);' string(0) ""
# 配置选项将被设置成为任何 '=' 字符之后的值 $ php -d max_execution_time=20 -r '$foo = ini_get("max_execution_time"); var_dump($foo);' string(2) "20"
$ php -d max_execution_time=doesntmakesense -r '$foo = ini_get("max_execution_time"); var_dump($foo);' string(15) "doesntmakesense

但是,q 参数没有,网上资料也找不到,查源码:

{'q', 0, "no-header"}, /* for compatibility with CGI (do not generate HTTP headers) */

不产生HTTP headers, 由于时间关系没有实际测试。

做笔记。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php中ASCⅡ码Next article:PHP getopt函数