PDO bindParam 参数length没看懂

来自https://www.php.net/manual/zh...
$sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12);
12是啥意思?没看懂

$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('SELECT name, colour, calories

FROM fruit
WHERE calories < :calories AND colour = :colour');

$sth->bindParam(':calories', $calories, PDO::PARAM_INT);
$sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12);
$sth->execute();

最佳答案