WordPress插件激活错误:激活期间意外输出

时间:2012-11-14 06:39:59

标签: php wordpress-plugin

该插件在激活期间生成了880个意外输出字符。如果您发现“已发送标头”消息,联合供稿问题或其他问题,请尝试停用或删除此插件。

我在安装插件时遇到此错误,请任何人都可以提供帮助 这是代码

<?php
/*
Plugin Name: Post Bottom Content Generator
Plugin URI: NULL
Description: This will add a image with url at the end of the post content.
Version:  1.0
Author: All Marketing Solutions
Author URI: 
*/
//table creation in the wordpress database
global $AMS_post_plugin_db_version;
$AMS_post_plugin_db_version = "1.0";
function create_AMS_table () 
{
   global $wpdb;
   $table_name = $wpdb->prefix . "AMS_post_plugin";
    $sql = "CREATE TABLE $table_name (
      AMS_post_plugin_id mediumint(9) NOT NULL AUTO_INCREMENT,
      AMS_post_plugin_time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
      AMS_post_plugin_name VARCHAR(55) NOT NULL,
      AMS_post_plugin_url VARCHAR(55) NOT NULL,
      AMS_post_plugin_path VARCHAR(200) NOT NULL,
      UNIQUE KEY id (id)
    );";
    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    dbDelta($sql);
    add_option("AMS_post_plugin_db_version", $AMS_post_plugin_db_version);
}
function insert_AMS_table() 
{
   global $wpdb;
   $name = "talha";
   $url = "talha";
   $path="talha";
   $rows_affected = $wpdb->insert( $table_name, array( 'AMS_post_plugin_time' => current_time('mysql'), 'AMS_post_plugin_name' => $name, 'AMS_post_plugin_url' => $url, 'AMS_post_plugin_path' => $path ) );
}
///these will activate these functions when plugin install
register_activation_hook(__FILE__,'create_AMS_table');
register_activation_hook(__FILE__,'insert_AMS_table');
?>

0 个答案:

没有答案