在我的(WordPress)函数中,当我尝试将代码1更改为代码2时出现此错误:
警告:无法修改标头信息 - 已在/ home / consumer中发送的标头(在/home/consumer/public_html/themeforward.com/demo2/wp-content/themes/Tutles/functions.php:1中开始输出)第99行/public_html/themeforward.com/demo2/wp-admin/theme-editor.php
代码1
array(
"name" => "Custom CSS",
"desc" => "Want to add any custom CSS code? Put in here, and the rest is taken care of. This overrides any other stylesheets. eg: a.button{color:green}",
"id" => $shortname."_custom_css",
"type" => "textarea",
"std" => ""
),
代码2
array(
"name" => "Link Color",
"desc" => "Want to add any custom CSS code? Put in here, and the rest is taken care of. This overrides any other stylesheets. eg: a.button{color:green}",
"id" => $shortname."_link_color",
"type" => "textarea",
"std" => ""
),
第89-102行:
// don't allow template files in subdirectories
if (false !== strpos($basename, '/')) continue;
$template_data = implode('', file( $template ));
$name = '';
if (preg_match( '|Single Post Template:(.*)$|mi', $template_data, $name))
$name = _cleanup_header_comment($name[1]);
if (!empty($name)) {
if(basename($template) != basename(__FILE__))
$post_templates[trim($name)] = $basename;
}
我对如何解决这个问题感到很困惑。
答案 0 :(得分:1)
您可能创建了一个文件(或编辑过的文件)。我假设functions.php?
该文件中可能有空格,无论是在文件的开头还是最后。
要防止在文件末尾发生空格,只需删除?>标签。同时删除每个文件开头的任何空格
答案 1 :(得分:0)
您的php文件是否在没有BOM的情况下以UTF8编码? 如果没有,请按照这种方式编码,然后重试。也许这是你得到错误的方式
答案 2 :(得分:0)
您的第一个<?php
代码前有空格或BOM。删除它
答案 3 :(得分:0)
使用某些编码时,某些编辑器会在文件的开头添加“dtž”(编辑器中未显示。