Se puede utilizar el siguiente plugin:
Aquí un tutorial para configurarlo:
https://www.luisrevuelto.es/manual-yoast-seo-wordpress-castellano/
Se puede utilizar el siguiente plugin:
Aquí un tutorial para configurarlo:
https://www.luisrevuelto.es/manual-yoast-seo-wordpress-castellano/
Dos enlaces de Microsiervos sobre deep learning:
https://www.microsiervos.com/archivo/ia/introduccion-aprendizaje-automatico-sesgos.html
https://www.microsiervos.com/archivo/ordenadores/aprendizaje-automatico-redes-neuronales-aprendizaje-profundo.html
class BD {
static $server = "localhost";
static $user = "root";
static $password = "";
static $database = "sakila";
private $table;
private $idField;
private $fields;
private $showFields;
static private $conn;
public function __construct($table, $idField, $fields = "", $showFields = "") {
$this->table = $table;
$this->idField = $idField;
$this->fields = $fields;
$this->showFields = $showFields;
self::conectar();
}
static function conectar() {
try {
self::$conn = new PDO("mysql:host=" . self::$server . ";dbname=" . self::$database, self::$user, self::$password, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"]);
self::$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
function __get($name) {
if (property_exists($this, $name)) {
return $this->$name;
}
}
function __set($name, $value) {
if (property_exists($this, $name) && !empty($value)) {
$this->$name = $value;
} else {
throw new Exception("Error: datos incorrectos");
}
}
function getAll($condicion = "") {
$where = "";
if (!empty($condicion)) {
//Aquí tendré que hacer algo!!!
$where = " where 1=1 ";
foreach ($condicion as $clave => $valor) {
$where .= " and " . $clave . " = '" . $valor . "' ";
}
}
$res = self::$conn->query("select * from " . $this->table . $where);
return $res->fetchAll(PDO::FETCH_ASSOC);
}
function getAllPrepare($condicion = []) {
$where = "";
if (!empty($condicion)) {
$where = " where ". join(" and ", array_map(function($v) {
return $v . "=:" . $v;
}, array_keys($condicion)));
}
$st = self::$conn->prepare("select * from " . $this->table . $where);
$st->execute($condicion);
return $st->fetchAll(PDO::FETCH_ASSOC);
}
/**
* Esta función nos devuelve el elemento de la tabla que tenga este id
* @param int $id El id de la fila
*/
function getById($id) {
$res = self::$conn->query("select * from " . $this->table . " where "
. $this->idField . "=" . $id);
return $res->fetch();
}
/**
* Elimina el registro que tenga el id que le pasamos
* @param int $id
*/
function deleteById($id) {
try {
self::$conn->exec("delete from " . $this->table . " where "
. $this->idField . "=" . $id);
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
/**
* Esta función toma como parámetro un array asociativo y nos inserta en la tabla
* un registro donde la clave del array hace referencia al campo de la tabla y
* el valor del array al valor de la tabla.
* ejemplo para la tabla actor: insert(['first_name'=>'Ana','last_name'=>'Pi'])
* @param type $valores
*/
function insert($valores) {
try {
$campos = join(",", array_keys($valores));
$parametros = ":" . join(",:", array_keys($valores));
$sql = "insert into " . $this->table . "($campos) values ($parametros)";
$st = self::$conn->prepare($sql);
$st->execute($valores);
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
/**
* Modifica el elemento de la base de datos con el id que pasamos
* Con los valores del array asociativo
* @param int $id Id del elemento a modificar
* @param array $valores Array asociativo con los valores a modificar
*/
function update($id, $valores) {
try {
//Easy way
$res = [];
foreach ($valores as $clave => $valor) {
$res[] = $clave . "=:" . $clave;
}
$campos = join(",", $res);
//Hack way
$campos = join(",", array_map(function($v) {
return $v . "=:" . $v;
}, array_keys($valores)));
$sql = "update " . $this->table . " set " . $campos . " where "
. $this->idField . " = " . $id;
$st = self::$conn->prepare($sql);
$st->execute($valores);
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
}
<?php
class BD {
static $server = "localhost";
static $user = "root";
static $password = "";
static $database = "sakila";
private $table;
static private $conn;
public function __construct($table) {
$this->table = $table;
self::conectar();
}
static function conectar() {
try {
self::$conn = new PDO("mysql:host=" . self::$server . ";dbname=" . self::$database, self::$user, self::$password, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"]);
self::$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
function getAll() {
$res = self::$conn->query("select * from " . $this->table);
return $res->fetchAll();
}
/**
* Esta función nos devuelve el elemento de la tabla que tenga este id
* @param int $id El id de la fila
*/
function getById($id) {
$res = self::$conn->query("select * from " . $this->table . " where "
. $this->table . "_id=" . $id);
return $res->fetch();
}
/**
* Elimina el registro que tenga el id que le pasamos
* @param int $id
*/
function deleteById($id) {
try {
self::$conn->exec("delete from " . $this->table . " where "
. $this->table . "_id=" . $id);
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
/**
* Esta función toma como parámetro un array asociativo y nos inserta en la tabla
* un registro donde la clave del array hace referencia al campo de la tabla y
* el valor del array al valor de la tabla.
* ejemplo para la tabla actor: insert(['first_name'=>'Ana','last_name'=>'Pi'])
* @param type $valores
*/
function insert($valores) {
try {
$campos = join(",", array_keys($valores));
$parametros = ":" . join(",:", array_keys($valores));
$sql = "insert into " . $this->table . "($campos) values ($parametros)";
$st = self::$conn->prepare($sql);
$st->execute($valores);
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
}
$actores = new BD("actor");
//print_r($actores->getAll());
$paises = new BD("country");
//$paises->insert(['country'=>'Chiquitistán']);
//print_r($paises->getAll());
//print_r($actores->getById(1));
$v = ['first_name' => 'Ana', 'last_name' => 'Pimiento'];
$actores->insert($v);
<?php
//Clases final
class Pepe {
public function saludo() {
echo "Hola";
}
final public function despedida(){
echo "Adios";
}
}
class Pepito extends Pepe {
public function saludo() {
echo "Hola a todo";
}
/* Esto da error
public function despedida(){
echo "Adios muy buenas";
}
*
*/
}
final class NoHeredable{
public $departamento;
}
//Esto da error
class QuieroHeredar extends NoHeredable{
}
$p=new Pepito();
?>
<?php
//Recorrer objetos
class MiClase {
public $var1 = 'valor 1';
public $var2 = 'valor 2';
public $var3 = 'valor 3';
protected $protected = 'variable protegida';
private $private = 'variable privada';
function iterateVisible() {
echo "MiClase::iterateVisible:<br/>";
foreach ($this as $clave => $valor) {
echo $clave." - ".$valor."<br/>";
}
}
}
$clase=new MiClase();
foreach($clase as $clave=>$valor){
echo $clave." - ".$valor."<br/>";
}
$clase->iterateVisible();
?>
<?php
//Rasgos (traits)
trait Educado {
function saludo() {
echo "Hola";
}
function despedida() {
echo "adios";
}
}
trait HTML {
function cabecera() {
echo "<h1>$this->nombre</h1>";
}
}
class Pepe {
use Educado;
}
class Juan {
public $nombre;
use Educado,
HTML;
}
$obj = new Pepe;
$obj->despedida();
$obj2 = new Juan();
$obj2->nombre="Juan";
$obj2->despedida();
$obj2->cabecera();
?>
<?php
//Interfaces
interface webHTML{
public function dibujaTabla();
public function dibujaCabecera($nombre);
}
class miTabla implements webHTML{
public function dibujaTabla() {
echo "<table><tr><td></td></tr></table>";
}
public function dibujaCabecera($nombre) {
echo "<h1>$nombre</h1>";
}
public function saludo(){
echo "hola";
}
}
class OtraTabla implements webHTML{
public function dibujaTabla() {
echo "hola";
}
public function dibujaCabecera($nombre) {
echo $nombre;
}
}
?>