从 wordpress class 扩展的命名空间不起作用
Namespace with extend from wordpress class not working
我在命名空间方面遇到了问题。当我放置命名空间时,我的应用程序将查找我在命名空间中扩展的 class,而我希望我的命名空间用于我的 Quote_Recieved class.
namespace emails;
class Quote_Received extends WC_Email {
...
但是我有这个错误:
Uncaught Error: Class 'emails\WC_Email' not found in C:\xampp\htdocs\wordpress\.....
如何为 Quote_Received 而不是 WC_Email 放置我的命名空间?
谢谢
由@CBroe 和他的评论解决:
Use \WC_Email, so that it looks for the class in the global namespace
我在命名空间方面遇到了问题。当我放置命名空间时,我的应用程序将查找我在命名空间中扩展的 class,而我希望我的命名空间用于我的 Quote_Recieved class.
namespace emails;
class Quote_Received extends WC_Email {
...
但是我有这个错误:
Uncaught Error: Class 'emails\WC_Email' not found in C:\xampp\htdocs\wordpress\.....
如何为 Quote_Received 而不是 WC_Email 放置我的命名空间? 谢谢
由@CBroe 和他的评论解决:
Use \WC_Email, so that it looks for the class in the global namespace