PHP 中的参数转发

发布于 2024-10-01 20:18:57 字数 363 浏览 4 评论 0原文

考虑以下函数:

function debug() {
  $args = func_get_args();
  // process $args
}

function debug_die() {
  // call debug() with the passed arguments
  die;
}

方法 debug_die 在调用采用可变数量参数的 debug 后退出。

因此,传递给 debug_die 的参数仅用于 debug,并且只需转发。如何在 debug_die 方法中完成此操作?

Consider the following functions:

function debug() {
  $args = func_get_args();
  // process $args
}

function debug_die() {
  // call debug() with the passed arguments
  die;
}

The method debug_die exits after calling debug that takes a variable number of arguments.

So the arguments passed to debug_die as such are meant for debug only and just have to be forwarded. How can this be done in the debug_die method?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

GRAY°灰色天空 2024-10-08 20:18:57
function debug_die() {
    call_user_func_array("debug", func_get_args());
    die;
}
function debug_die() {
    call_user_func_array("debug", func_get_args());
    die;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文