php文件中的参数通过cron运行

mrp*_*atg 4 php

我有一个需要在cronjob上运行的php文件,其顶部有以下内容

#!/usr/bin/php -q
Run Code Online (Sandbox Code Playgroud)

我知道的第一部分告诉服务器来解释用PHP文件导致其不被通过网络服务器上运行,但什么是-q呢?

还有,还有其他参数吗?如果是这样,我在哪里可以阅读更多关于它们.

谢谢

Mar*_*iek 9

-q指的是不显示标题信息的安静模式.现在默认情况下-q处于启用状态,但仍然支持向后兼容性.

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] -- [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               Display colour syntax highlighted source.
  -v               Version number
  -w               Display 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>.
  --ri <name>      Show configuration for extension <name>.
Run Code Online (Sandbox Code Playgroud)

php -l是我最常用的那个.编辑时很好,能够对文件运行快速语法检查(在vim中:! php -l %)