Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么这行不通?
$stmt = $pdo->prepare("SELECT :columns FROM table"); $stmt->bindParam(':columns', implode(', ', $columns), PDO::PARAM_STR);
有没有有效的方法来做到这一点?也许就像我上面的初始代码一样简单?
$pdo->prepare('SELECT ' . implode(', ', $columns) . 'FROM table');