如何以数组而不是标准类的形式从WordPress数据库中获取数据?

时间:2018-01-14 作者:wr-98

伙计们,我试过这个密码:

$wpdb->get_results(sprintf("SELECT ID FROM wp_posts WHERE ID = \'%s\' AND post_type = \'edd_payment\'",$id));
它返回了一个std类,我怎样才能以数组而不是std类的形式从数据库中获取数据?

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

See here$wpdb->get_results

$wpdb->get_results($query,ARRAY_A );

结束

相关推荐

Database Name Change

我读到,使用wp\\uu之外的其他东西作为数据库前缀更安全,所以我下载了我的数据库前缀wp\\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu