class play{
<code>private $message = null; public function __construct(){ } public function callback(event $event){ $this->message = $event->click(); ... }</code>
}
Please tell me why you need to add event before $event in public function callback(event $event)? What does the event here do?
Thank you
class play{
<code>private $message = null; public function __construct(){ } public function callback(event $event){ $this->message = $event->click(); ... }</code>
}
Please tell me why you need to add event before $event in public function callback(event $event)? What does the event here do?
Thank you
Type declaration: The formal parameter $event must be an instance of (class/interface) event or an instance of a subclass of event (or a class that implements the event interface)
Thank you, that is the parameter type restriction of PHP
function. That is, when you call $play->callback($event)
, if $event
is not of type event
, an error will be reported. The following picture is a table of the types that PHP
function parameters can be set.
Strictly limit input types.