informatica:programacion:php:frameworks:codeigniter
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
| informatica:programacion:php:frameworks:codeigniter [2021/03/01 20:21] – [Docker Compose] tempwin | informatica:programacion:php:frameworks:codeigniter [2024/12/04 11:54] (actual) – [CodeIgniter] tempwin | ||
|---|---|---|---|
| Línea 1: | Línea 1: | ||
| ====== CodeIgniter ====== | ====== CodeIgniter ====== | ||
| - | Framework de PHP. | + | Framework de [[informatica: |
| * [[https:// | * [[https:// | ||
| Línea 17: | Línea 17: | ||
| * Vista: resultado visual | * Vista: resultado visual | ||
| * Controlador: | * Controlador: | ||
| + | |||
| + | Además, CodeIgniter sigue el patrón FrontController, | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | Por ejemplo: | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | ==== Controlador ==== | ||
| + | |||
| + | '' | ||
| + | |||
| + | <code php> | ||
| + | <?php | ||
| + | |||
| + | namespace App\Controllers; | ||
| + | |||
| + | use CodeIgniter\Controller; | ||
| + | |||
| + | class Pages extends Controller | ||
| + | { | ||
| + | public function index() | ||
| + | { | ||
| + | return view(' | ||
| + | } | ||
| + | |||
| + | public function view($page = ' | ||
| + | { | ||
| + | // ... | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| ==== Modelo ==== | ==== Modelo ==== | ||
| Línea 35: | Línea 71: | ||
| * https:// | * https:// | ||
| + | |||
| + | |||
| ===== Instalación ===== | ===== Instalación ===== | ||
| Requisitos: | Requisitos: | ||
| - | * Versión de PHP 7.2 o superior con las siguientes extensiones: | + | * Versión de PHP 7.3 o superior con las siguientes extensiones: |
| * '' | * '' | ||
| * '' | * '' | ||
| Línea 47: | Línea 85: | ||
| Se [[https:// | Se [[https:// | ||
| + | |||
| + | Tendremos la siguiente estructura de directorios: | ||
| + | |||
| + | < | ||
| + | app/ | ||
| + | public/ | ||
| + | system/ | ||
| + | writable/ | ||
| + | </ | ||
| La web se servirá desde el directorio '' | La web se servirá desde el directorio '' | ||
| Línea 74: | Línea 121: | ||
| La carpeta ''/ | La carpeta ''/ | ||
| - | < | + | < |
| chmod 777 -R / | chmod 777 -R / | ||
| + | </ | ||
| + | |||
| + | Sin embargo, la recomendación es: | ||
| + | |||
| + | <code bash> | ||
| + | chown -R < | ||
| </ | </ | ||
| ===== Configuración ===== | ===== Configuración ===== | ||
| Línea 134: | Línea 187: | ||
| </ | </ | ||
| + | ===== Configuración inicial ===== | ||
| + | |||
| + | Abrimos '' | ||
| + | |||
| + | <code php> | ||
| + | public $baseURL = ' | ||
| + | </ | ||
| + | |||
| + | Si vamos a usar una base de datos, abrimos '' | ||
| + | |||
| + | <code php> | ||
| + | public $default = [ | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ]; | ||
| + | </ | ||
| + | |||
| + | ==== Fichero env ==== | ||
| + | |||
| + | Podemos establecer ciertas opciones/ | ||
| ====== Recursos ====== | ====== Recursos ====== | ||
informatica/programacion/php/frameworks/codeigniter.1614626461.txt.gz · Última modificación: por tempwin
