该插件在激活期间生成了683个字符的意外输出

时间:2021-06-18 作者:Ayana Memon

我面临着这个错误,请帮助我。

<?php
 /*Plugin Name: Contact Form
 Plugin URI: http://localhost/redspark/wp-admin
 Description: Contact Form Create & Retrive By Ajax
 Author: Shifa Memon
 Author URI: http://localhost/redspark/wp-admin
 Version: 1.0 */
 function custom_contact_form_create(){
// echo "Active";
// die();
global $wpdb;
global $table_prefix;
$table = $table_prefix . \'contact_us\';
    $sql = "CREATE TABLE \'wp_contact_us\' (
      `id` int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT,
      `name` varchar(50) NOT NULL,
      `email` varchar(100) NOT NULL,
      `subject` text NOT NULL,
      `message` longtext NOT NULL,
      `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON 
       UPDATE current_timestamp())";
       $wpdb->query($sql);
}
register_activation_hook(__FILE__,\'custom_contact_form_create\');

function custom_contact_form_delete(){
   global $wpdb;
   global $table_prefix;
   $table = $table_prefix.\'contact-us\';
   $sql = "DROP TABLE $table";
   $wpdb->query($sql);
   // echo "Deactivate";
  }
  register_deactivation_hook(__FILE__ ,\'custom_contact_form_delete\');

    ?>

enter image description here

1 个回复
最合适的回答,由SO网友:Ayana Memon 整理而成

最后插件被激活。。。

enter image description here

这是代码。。。

enter image description here

相关推荐