-
-
Save parzibyte/dc1338f2589c193b5383fd464fc22d66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function obtenerBaseDeDatosWordPress() | |
{ | |
$pass = ""; | |
$usuario = "root"; | |
$nombreBaseDeDatos = "wp"; | |
$baseDeDatos = new PDO('mysql:host=localhost;dbname=' . $nombreBaseDeDatos, $usuario, $pass); | |
$baseDeDatos->query("set names utf8;"); | |
$baseDeDatos->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE); | |
$baseDeDatos->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
$baseDeDatos->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); | |
return $baseDeDatos; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment