让我们举几个例子。
public function do_this($id, $title = NULL, $status = false, $permission = false){
//Do the task
}
根据上述功能$title
,$status
和$permission
是可选参数。
do_this(15);
do_this(15, NULL, false, true);
所以即使有三个参数是可选的,当我只需要使用一个可选参数时,我必须传递所有四个参数。
我正在做的是正确的还是只能通过id和权限参数。