首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >让phpdbg将SAPI报告为"cli“而不是"phpdbg”

让phpdbg将SAPI报告为"cli“而不是"phpdbg”
EN

Stack Overflow用户
提问于 2018-03-05 10:06:45
回答 1查看 335关注 0票数 0

当在命令行上运行phpdbg时,从php_sapi_name()返回的值是"phpdbg“而不是" CLI ",这会扰乱我的一些代码,以确保代码是在命令行界面上运行的,而不是在web服务中运行的。

我不想为了适应调试器而更改代码。有没有办法让phpdbg将SAPI报告为"cli“而不是"phpdbg"?

EN

回答 1

Stack Overflow用户

发布于 2018-03-05 10:06:45

在调用phpdbg时,您可以指定-S开关来指定要报告为SAPI的任何名称。例如phpdbg -Scli将其恢复为"cli“。

phpdbg的官方在线文档在https://phpdbg.room11.org/。但是,它似乎非常过时,并且没有提到-S选项。要查看当前选项列表,请运行phpdbg并使用help options命令。

代码语言:javascript
复制
$ phpdbg
prompt> help options

Below are the command line options supported by phpdbg

Command Line Options and Flags
  Option  Example Argument    Description
  -c      -c/my/php.ini       Set php.ini file to load
  -d      -dmemory_limit=4G   Set a php.ini directive
  -n                          Disable default php.ini
  -q                          Suppress welcome banner
  -v                          Enable oplog output
  -b                          Disable colour
  -i      -imy.init           Set .phpdbginit file
  -I                          Ignore default .phpdbginit
  -O      -Omy.oplog          Sets oplog output file
  -r                          Run execution context
  -rr                         Run execution context and quit after execution (not respecting
breakpoints)
  -e                          Generate extended information for debugger/profiler
  -E                          Enable step through eval, careful!
  -s      -s=, -s=foo         Read code to execute from stdin with an optional delimiter
  -S      -Scli               Override SAPI name, careful!
  -l      -l4000              Setup remote console ports
  -a      -a192.168.0.3       Setup remote console bind address
  -x                          Enable xml output (instead of normal text output)
  -p      -p, -p=func, -p*    Output opcodes and quit
  -h                          Print the help overview
  -V                          Print version number
  --      -- arg1 arg2        Use to delimit phpdbg arguments and php $argv; append any $argv argument after it
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49102518

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档