PDO默认使用哪种绑定类型


Which binding type does PDO use by default?

根据文档,您可以通过三种主要方式进行绑定:http://www.php.net/manual/en/pdostatement.execute.php

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

第一个方法可以指定Param_(Str/int)来匹配您的表,并确保给出了正确的用户信息。其他两个是否自动查找表的数据类型?另外两个如何选择它们的数据类型?似乎第一个更安全。

您链接到的执行文档在参数下说:"所有值都被视为PDO::PARAM_STR