Drupal get database configuration
Is there any function preserved to extract da开发者_Python百科tabase configuration inside of my code, something like
$db_user = drupal_get_dbuser();
$db_pass = drupal_get_dbpass();
...
...
The code for this is:
<?php
global $db_url;
$creds = parse_url($db_url);
print $creds['user'];
print $creds['pass'];
var_dump($creds);
?>
More detailed info and edge-cases can be found by reading the code of http://api.drupal.org/api/function/db_connect/6
精彩评论