问题
How do you use _autoload in PHP 5.3 with namespaces? I have a main autoload function in a namespace separate from my script. I'm also calling a class with a different namespace. (It's not surprising, but) It's not finding the autoload function. Do I have to recreate the autoload function for each namespace? That seems suboptimal.
Thanks in advance for any help!
回答1:
From a comment in the PHP manual:
To use autoload function with namespaces you should remember to define it in main scope in "\" namespace.
来源:https://stackoverflow.com/questions/1354944/autoload-with-namespaces-in-php-5-3