有没有一种方法可以根据()内传递的内容返回部分函数?举个例子:PHP根据参数返回函数的不同部分
function test($wo) {
if function contains $wo and "date" {
//pass $wo through sql query to pull date
return $date
}
if function contains $wo and "otherDate" {
//pass $wo through another sql query to pull another date
return $otherDate
}
if function only contains $wo {
//pass these dates through different methods to get a final output
return $finaldate
}
}
日期:
test($wo, date);
返回:
1/1/2015
otherDate:
test($wo, otherDate);
返回:
10/01/2015
正常输出:
test($wo);
返回:
12/01/2015
你将不得不放弃一个更好的例子有预期的输入/输出等... – AbraCadaver
希望现在更清楚 –