注册 登录
编程论坛 PHP技术论坛

函数 wpdb::prepare 的调用方法不正确。 无效的值类型(object)

Hector0371 发布于 2022-09-10 12:39, 756 次点击
报错点在/wp-includes/functions.php on line 5831  。完整报错如下:

[10-Sep-2022 04:04:07 UTC] PHP Notice:  函数 wpdb::prepare 的调用方法<strong>不正确</strong>。 无效的值类型(object)。 请查阅<a href="https://调试WordPress</a>来获取更多信息。 (这个消息是在4.8.2版本添加的。) in /www/wwwroot/www. on line 5831
[10-Sep-2022 04:04:07 UTC] PHP Notice:  Undefined index: id in /www/wwwroot/www. on line 70

而wordpress的原始文件我没动。我是在自己的theme文件夹/functions.php里编辑的,完整的代码如下

 use WeDevs\Dokan\Withdraw;
    use WP_Error;
    use WeDevs\Dokan\Cache;      
    use WeDevs\Dokan;
    use WeDevs\Dokan\Withdraw\Withdraws;
           
    add_action( 'woocommerce_order_status_completed', 'Neo_friendsexchange_core', 99 );


    function Neo_friendsexchange_core($order_id) {
            
            global $wpdb;
            
            
         

         
    ///总纲:创建withdraw,执行withdraw,将vendorbalance转移给TeraWallet  method=》wallet,更新withdraw状态为完成,收尾

            
            
            $RootDir = rtrim(str_replace('\\','/', $_SERVER['DOCUMENT_ROOT']), '/');
            $fileDir=$RootDir . '/wp-content/plugins/dokan-lite/includes/Withdraw/Withdraw.php';
            require($fileDir);
            

                         $Neo_order = dokan()->order->get( $order_id );//wc_get_order( $order_id );
                        





                         $seller_id = dokan_get_seller_id_by_order($Neo_order); //$order
                         $amount = dokan_get_seller_balance( $seller_id, false );// 也许需要wc和DOkan之间的ID转变,也许需要add action
            
                        

                         $withdraw=new WeDevs\Dokan\Withdraw\Withdraw();
                        
                         $withdraw->save();  
                        

                         $withdraw->get_withdraw();
                         $withdraw->set_method('woo_wallet');
                         $withdraw->set_user_id($seller_id);
                        

                         $withdraw->set_amount($amount);
            
           
                         do_action( 'dokan_withdraw_created', $withdraw );   
                                                               

            
            
                          //To approve   
            
            
                         $withdraw->set_status( dokan()->withdraw->get_status_code( 'approved' ) );
            
            
                         do_action( 'dokan_withdraw_updated', $withdraw );// ?$withdraw

                       
                       
                        file_put_contents("./result.txt",var_export($wpdb->queries,true));
            
    }


            
            
            
     网上查不到报错方式,有哪位大佬愿意告诉我如何解决吗?十分感谢
            


 
0 回复
1