Doubts about composer's autoload source code
mmmm
mmmm 2018-04-01 11:48:56
0
0
921

Problem description, I looked at composer's autoload today, and there is such a code in the autoload_real.php pointed to:

spl_autoload_register(array('ComposerAutoloaderInitc80c5962bd70112ae6c86782593af788', 'loadClassLoader'), true, true);

The description of the first parameter of spl_autoload_register given in the php manual is:

autoload_function

The autoload function to be registered. If no parameters are provided, the default implementation function spl_autoload() of autoload is automatically registered.

The manual says that the first parameter is a function. If it is not provided, the function spl_autoload() will be implemented by default.

The class name in autoload_real.php is: ComposerAutoloaderInitc80c5962bd70112ae6c86782593af788,

There is a static method loadClassLoader($class) in the class.

After thinking about it, if the first member of array('ComposerAutoloaderInitc80c5962bd70112ae6c86782593af788', 'loadClassLoader') is the class name and the second member is the static method name, is it equivalent to self? ::loadClassLoader(). But the question is, how to bring the parameters of loadClassLoader? I really can’t figure it out.

Finally, I did a practice, created a class myself, created a static method, and imitated the above array method. As a result, the function was not executed, but an array was honestly created. ? ? So what does that line of code in composer do? I hope the seniors who know it can teach me.


mmmm
mmmm

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template