Home > Backend Development > PHP Tutorial > PHP Callback callback type js callback call back to asynccallbac

PHP Callback callback type js callback call back to asynccallbac

WBOY
Release: 2016-07-29 08:54:10
Original
1081 people have browsed it

When I looked at autoload of composer, I found that he used spl_autoload_register to register a class class. .

I clearly remember to pass in a autoload function queue to be registered. I checked the documentation and found out that I had a misunderstanding of the Callback callback type

See the example of the Callback callback type in the documentation:

<code><span>// Type 1: Simple callback</span>
call_user_func(<span>'my_callback_function'</span>); 

<span>// Type 2: Static class method call</span>
call_user_func(<span>array</span>(<span>'MyClass'</span>, <span>'myCallbackMethod'</span>)); 

<span>// Type 3: Object method call</span><span>$obj</span> = <span>new</span> MyClass();
call_user_func(<span>array</span>(<span>$obj</span>, <span>'myCallbackMethod'</span>));

<span>// Type 4: Static class method call (As of PHP 5.2.3)</span>
call_user_func(<span>'MyClass::myCallbackMethod'</span>);

<span>// Type 5: Relative static class method call (As of PHP 5.3.0)</span><span><span>class</span><span>A</span> {</span><span>public</span><span>static</span><span><span>function</span><span>who</span><span>()</span> {</span><span>echo</span><span>"A\n"</span>;
    }
}

<span><span>class</span><span>B</span><span>extends</span><span>A</span> {</span><span>public</span><span>static</span><span><span>function</span><span>who</span><span>()</span> {</span><span>echo</span><span>"B\n"</span>;
    }
}

call_user_func(<span>array</span>(<span>'B'</span>, <span>'parent::who'</span>)); <span>// A</span></code>
Copy after login

There are 5 callback types here, not just function

Learn and encourage each other. .

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the PHP Callback callback types, including the content of call and back. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template