dongxue163536 2017-11-20 11:29
浏览 124
已采纳

Wordpress - 从自己的插件中保存数据

My own wordpress plugin generates this data of a file:

filename|creator|date

    This is my filename|Max Mustermann|20.11.2017
    This is my filename|Anne Mustermann|26.11.2017
    This is my filename|Alex Mustermann|27.11.2017

How is wordpress built to save this data? How do I do that the right way?

Thanks for your answers!

Lingo

  • 写回答

1条回答 默认 最新

  • dongyoucha0645 2017-11-20 12:19
    关注

    Try this example,

    function bot_install()
    {
        global $wpdb;
        $table = $wpdb->prefix."bot_counter";
        $structure = "CREATE TABLE $table (
            id INT(9) NOT NULL AUTO_INCREMENT,
            bot_name VARCHAR(80) NOT NULL,
            bot_mark VARCHAR(20) NOT NULL,
            bot_visits INT(9) DEFAULT 0,
        UNIQUE KEY id (id)
        );";
        $wpdb->query($structure);
     
        // Populate table
        $wpdb->query("INSERT INTO $table(bot_name, bot_mark)
            VALUES('Google Bot', 'googlebot')");
        $wpdb->query("INSERT INTO $table(bot_name, bot_mark)
            VALUES('Yahoo Slurp', 'yahoo')");
    }

    You get the result.

    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 Keil uVision5创建project没反应
  • ¥15 mmseqs内存报错
  • ¥15 vika文档如何与obsidian同步
  • ¥15 华为手机相册里面的照片能够替换成自己想要的照片吗?
  • ¥15 陆空双模式无人机飞控设置
  • ¥15 sentaurus lithography
  • ¥100 求抖音ck号 或者提ck教程
  • ¥15 关于#linux#的问题:子进程1等待子进程A、B退出后退出(语言-c语言)
  • ¥20 web页面如何打开Outlook 365的全球离线通讯簿功能
  • ¥15 io.jsonwebtoken.security.Keys