拦截器__call,_callstatic

<?php
    class Test
    {
        public function say()
        {
            echo 'say';
        }

        public function __call($method,$argument)
        {
            echo '你调用了一个不存在的方法'.$method.'<br/>';
            echo '而且传了参数<br/>';
            print_r($argument);
            echo '<br/>';
        }

        public static function __callstatic($method,$argument)
        {
            echo '你调用了一个不存在的静态方法'.$method.'<br/>';
            echo '而且传了参数<br/>';
            print_r($argument);
            echo '<br/>';
        }
    }

    $test = new Test;
    $test->cry('a,','b','c');
    Test::fly(1,2,3);
?>
相关文章
相关标签/搜索