不幸的是PHP不支持命名参数,但我注意到PHP语法允许我们类似的东西:
function list_items( $user, $archived ) { ... }
// This is the default way to call the function.
// It's not very clear what the value and false refer to:
list_items( 10, false );
// Alternative syntax I found which makes this more clear:
list_items( $user = 10, $archived = false );
两个函数调用都返回相同的数据。
问题
答案 0 :(得分:0)
回答这个问题:没有命名参数。
我的问题中的示例只是将值赋给变量,然后将这些变量传递给函数。
self.loggedinuserdata = snapshot.value as? NSDictionary
self.databaseref.child("posts").child(self.loggedinuser!.uid).observeSingleEvent(of: .childAdded, with: {(snapshot: FIRDataSnapshot ) in
self.posts.append(snapshot.value as! NSDictionary)
self.feeds.insertRows(at: [IndexPath(row : 0 ,section : 0)], with: UITableViewRowAnimation.automatic)
}) {(error) in
print(error.localizedDescription)
}
}