如何记录可变数量的参数

发布于 2024-09-16 12:00:54 字数 229 浏览 3 评论 0原文

如何记录可变数量的参数?我正在用 PHP 和 JavaScript 编写一个应用程序。目前我有(在 JavaScript 中):

/**
 * Description
 * @param {String} description
 */
function fn()
{
  // arguments holds all strings.
}

那么,如何记录 n 个字符串参数?

How do I doc a variable number of parameters? I am writing an application in PHP and JavaScript. Currently I have (in JavaScript):

/**
 * Description
 * @param {String} description
 */
function fn()
{
  // arguments holds all strings.
}

So, how do I doc n-number of string params?

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

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

发布评论

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

评论(1

御弟哥哥 2024-09-23 12:00:54

例如 PhpDocumentor 建议使用省略号

/**
 * Example of unlimited parameters.
 * Returns a formatted var_dump for debugging purposes
 * (since the recurrences of $v are not listed in the actual function signature in the code,
 * you may wish to highlight they are "optional" in their description)
 * @param string $s string to display
 * @param mixed $v variable to display with var_dump()
 * @param mixed $v,... unlimited OPTIONAL number of additional variables to display with var_dump()
 */
function fancy_debug($s,$v)
{

E.g. PhpDocumentor suggests using an ellipsis

/**
 * Example of unlimited parameters.
 * Returns a formatted var_dump for debugging purposes
 * (since the recurrences of $v are not listed in the actual function signature in the code,
 * you may wish to highlight they are "optional" in their description)
 * @param string $s string to display
 * @param mixed $v variable to display with var_dump()
 * @param mixed $v,... unlimited OPTIONAL number of additional variables to display with var_dump()
 */
function fancy_debug($s,$v)
{
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文