开发者

Function in PHP deprecated, what should I use now?

I have this code in one of my classes

 public function __call($method, $args) {

        array_unshift($args, $method);

        call_user_method_array('view',开发者_开发百科 $this, $args);

    }

We've since switched servers, and they must use a newer version of PHP5, and I get the following message

Function call_user_method_array() is deprecated

Is there where I should use reflection? What exactly is it, and how would I use it to modify my code above to work as it used to?


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

The call_user_method_array() function is deprecated as of PHP 4.1.0.

New way:

<?php
// Old:
// call_user_method_array('view', $this, $args);
// New:
call_user_func_array(array($this, 'view'), $args);
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜