504错误如何修复这个select count错误

t3psigkw  于 2021-06-15  发布在  Mysql
关注(0)|答案(0)|浏览(210)

我的php脚本中有一个504网关超时错误,如何拆分这个脚本,或者如何修复这个错误

$mp3FilesOnServer = getDirContents($uploadsDir);

$newMp3FilesOnServer = array();

foreach ($mp3FilesOnServer as $fileFullPath) {
    $fileName = preg_replace('#^.*?([\/\\\\]+wp-content.*)$#', '$1', $fileFullPath);
    $fileName = str_replace('\\', '/', $fileName);
    $query = $wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->postmeta . ' 
        LEFT JOIN ' . $wpdb->posts . ' ON ' . $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id  
        WHERE meta_key = "mp3file_name" AND meta_value LIKE %s AND ' . $wpdb->posts . '.post_status != "trash"', $fileName);
    $isDb = (int) $wpdb->get_var($query);

    if (!$isDb)
        $newMp3FilesOnServer[] = array(
            'fullPath' => $fileFullPath,
            'name' => $fileName
        );
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题