[英]When Class method same name php function
Consider this code: 考虑以下代码:
class some_class extends someother_class
{
function delete()
{
delete($somefile); // <-- That refers to the PHP function called delete
parent::delete(); // <-- That refers to the delete() method in the parent class
}
}
How do I use the PHP function delete from within the delete method in the extended class? 如何在扩展类的delete方法中使用PHP函数delete?
You should be able to use call_user_func_array()
here: 您应该可以在这里使用call_user_func_array()
:
class some_class extends someother_class
{
function delete()
{
call_user_func_array('delete', array($somefile));
parent::delete();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.