开发

The plugin generated 2 characters of unexpected output during activation.

解决WordPress插件激活时出现意外输出错误的方法,通过删除PHP文件开头的空格字符来修复问题。

· 1 分钟阅读

解决WordPress插件激活时出现意外输出错误的方法,通过删除PHP文件开头的空格字符来修复问题。

自己开发的插件,激活时出现以下错误:

The plugin generated 2 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

后来发现,在两个php文件的开头各有一个空格,删掉之后,就没事了。

参考了这个帖子:php - The plugin generated X characters of unexpected output during activation (WordPress) - Stack Overflow