Class play{
private $message = null;public function __construct(){}public function callback(event $event){ $this->message = $event->click(); ...}
}
Please ask the Public function callback (event $event) in the $event before why add event? What is the purpose of the event here?
Thank you
Reply content:
Class play{
private $message = null;public function __construct(){}public function callback(event $event){ $this->message = $event->click(); ...}
}
Please ask the Public function callback (event $event) in the $event before why add event? What is the purpose of the event here?
Thank you
Type declaration: The parameter $event must be an instance of (class/interface) event or a subclass of event (or a class that implements the event interface)
Thank you, that's the PHP
parameter type limit for the function. That is, when you call $play->callback($event)
, if $event
it is not event
the type, it will be an error. A table of PHP
types can be set with a slice being a function parameter.
The input type is strictly restricted.