php - PDO 事件常量

标签 php events pdo triggers

我对使用 PDO 常量的 PHP 有点怀疑。 我如何使用它?这里没有文档,没有示例,也没有关于它的问题。

有人将其付诸实践知道如何使用它吗?

PDO::PARAM_EVT_FREE (integer)

 Deallocation event

PDO::PARAM_EVT_EXEC_PRE (integer)

 Event triggered prior to execution of a prepared statement.

PDO::PARAM_EVT_EXEC_POST (integer)

 Event triggered subsequent to execution of a prepared statement.

PDO::PARAM_EVT_FETCH_PRE (integer)

 Event triggered prior to fetching a result from a resultset.

PDO::PARAM_EVT_FETCH_POST (integer)

 Event triggered subsequent to fetching a result from a resultset.

PDO::PARAM_EVT_NORMALIZE (integer)

 Event triggered during bound parameter registration allowing the driver to normalize the parameter name.

http://php.net/manual/en/pdo.constants.php

最佳答案

这些常量在 PHP 代码中没有用处,而且我真的认为它们不会很快派上用场。 As you can see here它们是内部 PDO api 的一部分。事件 Hook 在内部用于区分驱动程序:分配一个准备好的语句,它的绑定(bind)值发生在不同的驱动程序上需要不同的方法。 (注意 #if PDO_USE_MYSQLND#else 宏)

也许它们是作为类常量添加的,以使用户能够根据需要为这些事件传递回调。如果是这样,我不认为这被认为是 PDO 开发人员的首要任务,尽管......
底线:您不能使用它们,只需忽略它们

关于php - PDO 事件常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25935598/

相关文章:

javascript - PHP 代码返回其脚本并且在 JQuery Ajax 中不起作用

javascript - JS 中有点单例

php - PDO + MySQL 和损坏的 UTF-8 编码

php - 用PHP检查IE不好吗

php - 在同一页面上输出的简单 html/php 表单

php - 如何从查看源代码中隐藏 Wordpress 详细信息

wpf - 将 ViewModel 上的方法附加到 WPF 中的事件

javascript - 两个(或n个)脚本之间的通信 - 事件

PHP PDO : How to deal with bindValue() and reserved keywords?

php - 使用 PHP 和 strotime() 函数查看和更改 mysql 上的数据