PSR0 —— Autoloading Standard
PSR4 —— Autoloader
按照PSR0里面的约束,命名空间里的下划线(_)必须自动转换成空间分隔符(\);
但是在PSR4里,有描述写到:Underscores have no special meaning in any portion of the fully qualified class name.
PSR4貌似强调的是可以注册不同磁盘位置的库,而不用将库放在一个地方了。
但意思是不是之前PSR0里面说的又不算了?还是我理解错了?但是我看了PSR4的例子代码,没看到转换下划线的部分啊。反倒是PSR0里面写了`str_replace('_', DIRECTORY_SEPARATOR, $className);`这句。
还是说……PHP是一个连标准都不规范的语言……呢?
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md
PSR4 —— Autoloader
按照PSR0里面的约束,命名空间里的下划线(_)必须自动转换成空间分隔符(\);
但是在PSR4里,有描述写到:Underscores have no special meaning in any portion of the fully qualified class name.
PSR4貌似强调的是可以注册不同磁盘位置的库,而不用将库放在一个地方了。
但意思是不是之前PSR0里面说的又不算了?还是我理解错了?但是我看了PSR4的例子代码,没看到转换下划线的部分啊。反倒是PSR0里面写了`str_replace('_', DIRECTORY_SEPARATOR, $className);`这句。
还是说……PHP是一个连标准都不规范的语言……呢?
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md