php cli 参数

发现脚本中 /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, 由于时间关系没有实际测试。

做笔记。

原文地址:https://www.cnblogs.com/zoro/p/2319215.html