下列常量由此扩展定义,且仅在此扩展编译入 PHP 或在运行时动态载入时可用。
PDO uses class constants since PHP 5.1. Prior releases use global constants in the form PDO_PARAM_BOOL.
Note: The magic __set() method is called if the property doesn't exist in the requested class
Example #1 using PDO::ATTR_DRIVER_NAME
<?php
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
echo "Running on mysql; doing something mysql specific here\n";
}
?>