将wordpress安装从开发移动到实时主机后,非法字符串偏移警告已开始出现。违规代码与下面显示的自定义表单插件功能有关:
function __construct( $data='', $args='' ) {
if( is_array($args) ) extract($args);
// Show start & end tags
$this->formtags = true;
// Echo the form
$this->echo = true;
// Use Ajax
$this->ajax = true;
// Show ":" in labels
if( !$colon ) $this->colon = $colon;
else $this->colon = true;
// Process as collection of "p" elements
$this->class_mode = 'p'; // 'p', 'input'
// Set path for our transformations
$this->path = $path ? $path : dirname(__FILE__);
// Sanitize & assign data & xsl
if( !$data ) $data = 'contact';
$this->set( $data );
//Set Wrapper tag
if( $args['wrapper_tag'] ) $this->wrapper_tag = $args['wrapper_tag'];
else $this->wrapper_tag = 'p';
}
最终的if / else语句导致问题:
if( $args['wrapper_tag'] ) $this->wrapper_tag = $args['wrapper_tag'];
else $this->wrapper_tag = 'p';