[英]how to make parent method to be called using $this->methodName in PHP?
[英]How to use $this->methodname in PHP session_set_save_handle?
我有一个 Session 类,里面有我所有的 on_session_write、on_session_read 等方法。 在我的构造函数中,我让它启动
session_set_save_handler("on_session_start", "on_session_end",
"on_session_read", "on_session_write",
"on_session_destroy", "on_session_gc");
还有 session_start() 在这个我唯一的问题是需要使用 $this-> 调用方法,因为一切都在类中。 我如何做到这一点?
这很简单:
array($this,'methodName');
这是对方法的回调。
array('className','methodName');
这是对静态方法的回调。
您可以将array($this, 'methodName')
作为参数传递。 阅读更多关于 (死链接)http://php.net/manual/en/language.pseudo-types.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.