且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Wordpress dbDelta 函数无法执行我的查询

更新时间:2023-02-06 21:16:46

(这个答案随着 OP 提供了更多代码而演变.这是最终的简化答案!)

wordpress dbDelta 函数会分解它在 ';' 上给出的字符串,该字符串位于您的 JSON 中.您需要做的是将您的查询分成一个数组,然后将其传递给 dbDelta.

The wordpress dbDelta function explodes the string it is given on ';', which is inside your JSON. What you need to do is separate your queries into an array, and pass that to dbDelta instead.

$sql1=array();
$sql1[]="insert into....";
$sql1[]="insert into....";

dbDelta($sql1);