PHP中的函数已弃用,我现在应该使用什么?

ale*_*lex 5 php deprecated

我的一个课程中有这个代码

 public function __call($method, $args) {

        array_unshift($args, $method);

        call_user_method_array('view', $this, $args);

    }
Run Code Online (Sandbox Code Playgroud)

我们已经切换了服务器,他们必须使用更新版本的PHP5,我收到以下消息

Function call_user_method_array() is deprecated
Run Code Online (Sandbox Code Playgroud)

我应该在哪里使用反射?究竟是什么,以及如何使用它来修改上面的代码以便像以前一样工作?

Thi*_*lem 24

http://php.net/manual/en/function.call-user-method-array.php

自PHP 4.1.0起,不推荐使用call_user_method_array()函数.

新方法:

<?php
// Old:
// call_user_method_array('view', $this, $args);
// New:
call_user_func_array(array($this, 'view'), $args);
?>
Run Code Online (Sandbox Code Playgroud)