运行时sudo wp install plugin pluginname --allowroot
它会导致错误:
PHP致命错误:未捕获错误:在/var/www/html/wp-content/plugins/pluginname/blocks中不在对象上下文中时使用$this。菲律宾比索:89
我们有一个自定义插件,其中包含以下内容:
class Block{
public static function Run() {
add_action(\'enqueue_block_editor_assets\',array($this,\'RegisterBlock\')); //complains on this line
通过WP admin安装时-工作正常。但使用WP-CLI时会失败。任何帮助都将不胜感激