访问函数参数 [英] accessing function arguments
问题描述
我有以下代码:
函数some_function($ argument)
{
validate_arg();
//更多代码
}
函数validate_arg()
{
//此函数验证some_function()的参数
}
validate_args()可以自动读取
some_function()或者我必须在任何
案的括号中注明参数吗?
thx,micha
-
i have the following code:
function some_function($argument)
{
validate_arg();
//more code
}
function validate_arg()
{
//this function validates the argument of some_function()
}
is it possible for validate_args() to automatically read the argument of
some_function() or do i have to note the argument in the brackets in any
case?
thx, micha
--
推荐答案
参数)
{
validate_arg();
//更多代码
}
函数validate_arg()
{
//这个函数验证some_function()的参数
}
validate_args()可以自动读取
some_function()的参数或者我必须在任何
$ b的括号中注明参数$ b case?
thx,micha
-
argument)
{
validate_arg();
//more code
}
function validate_arg()
{
//this function validates the argument of some_function()
}
is it possible for validate_args() to automatically read the argument of
some_function() or do i have to note the argument in the brackets in any
case?
thx, micha
--
micha,
micha,
validate_args()是否可以自动读取
some_function()的参数,或者我必须在任何
情况下的括号中注明参数?
is it possible for validate_args() to automatically read the argument of
some_function() or do i have to note the argument in the brackets in any
case?
但是你可以做的事情如下:
function some_function(){
if(!validate_args(func_get_args())){
返回false;
}
// some_function有效...
}
这会将some_function的所有参数发送到
validate_args。
Mike
No however what you can do is something like the following:
function some_function() {
if (!validate_args(func_get_args())) {
return false;
}
//some_function is valid...
}
This will send all of the arguments from some_function over to
validate_args.
Mike
2005年5月19日星期四07:56:25 -0500,Mike Willbanks写道:
On Thu, 19 May 2005 07:56:25 -0500, Mike Willbanks wrote:
if(!validate_args(func_get_args())){
if (!validate_args(func_get_args())) {
来自手册:此功能不能直接用作功能
参数。
-
Firefox Web浏览器 - 重新发现网页 - http:/ /getffox.com/
Thunderbird电子邮件和新闻组 - http ://gettbird.com/
这篇关于访问函数参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!