PHP 循环退出 post_meta

问题描述

我想为 viber bot 制作按钮。它们应该如下所示:

   $buttons[] =
                    (new \Viber\Api\Keyboard\Button())
                        ->setColumns(3)
                        ->setActionType('reply')
                        ->setActionBody('Renault')
                        ->setText('Renault');
                                        $buttons[] =
                    (new \Viber\Api\Keyboard\Button())
                        ->setColumns(3)
                        ->setActionType('reply')
                        ->setActionBody('Peugeot')
                        ->setText('Peugeot');

我怎样才能在setActionBody setText中制作一个循环来写一个汽车品牌(make)?

我从数据库中获取了一个带有品牌的数组,并从中提取了一个字符串:

global $wpdb;
    $makes = $wpdb->prepare("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = 'make' ",ARRAY_A);
    $makes = $wpdb->get_col( $makes );
    $makes = array_unique($makes);
    $makes = implode( ' ',$makes );
    $makes = ucwords ($makes);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...