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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录