【问题标题】:Is it possible to turn a PHP XML Exporter into a Wordpress plugin?是否可以将 PHP XML Exporter 变成 Wordpress 插件?
【发布时间】:2014-12-11 13:03:57
【问题描述】:

我使用 mysql1 制作了一个带有表单的 PHP 脚本,可用于将数据从数据库导出到 XML 文件。我的问题是我可以将它用作 Wordpress 插件吗?

我面临的最大问题是 wordpress 使用 $wpdb 与我一直使用 PHP MySQL 函数的数据库进行交互。有什么方法可以将 PHP 脚本转换为 wordpress 插件?

【问题讨论】:

    标签: php xml wordpress


    【解决方案1】:
    As you know, mysql_fetch_assoc() processes the results returned by mysql_query(). $wpdb class methods typically return results of a query to the wordpress database similar to what mysql_query() would do. $wpdb class methods do not process such results as mysql_fetch_assoc() would do, so there is no true equivalent.
    

    我通常对类似于您的示例的 $wpdb 查询的结果执行以下操作:

    foreach ($results as $row) { // 在这里做代码来处理 db 结果。

    【讨论】:

      猜你喜欢
      • 2011-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-25
      • 1970-01-01
      相关资源
      最近更新 更多