网站优化

网站优化

Products

当前位置:首页 > 网站优化 >

如何在WordPress插件中使用类的命名空间

GG网络技术分享 2025-03-18 16:12 1


问题描述:

I am developing a wordpress plugin using OOPS concept with classes.

I want to use namespace in them.

Does anyone has any idea how to implement that in my plugin ?

Thanks

图片转代码服务由CSDN问答提供

感谢您的意见,我们尽快改进~

功能建议

我正在使用带有类的OOPS概念开发一个wordpress插件。

我想在其中使用命名空间。

任何人 有任何想法如何在我的插件中实现它?

谢谢</ p>

</ div>

网友观点:

Please define namespace with first line and use like we do it below.

    

<?php

namespace Appsense\\popop;

class shortcode{

public function gernerateShortcode(){

add_shortcode(\'appsense_popop\',array(\'Appsense\\popop\\shortcode\',\'popop_shortcode\'));

}

public function popop_shortcode(){

$output = \\\"Hello world!\\\";

return $output;

}

}

标签:

提交需求或反馈

Demand feedback