1 / 24

Desarrollo Web en PHP 5.0 con servidor Apache 2.0

Desarrollo Web en PHP 5.0 con servidor Apache 2.0. Alberto Gimeno Arnal alberto.gimeno@gmail.com. Área de Lenguajes y Sistemas Informáticos Dpto. de Informática e Ingeniería de Sistemas Universidad de Zaragoza. Configuración PC (software). apache_2.0.58-win32-x86-no_ssl.msi

menora
Télécharger la présentation

Desarrollo Web en PHP 5.0 con servidor Apache 2.0

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Desarrollo Web en PHP 5.0 con servidor Apache 2.0 Alberto Gimeno Arnal alberto.gimeno@gmail.com Área de Lenguajes y Sistemas Informáticos Dpto. de Informática e Ingeniería de Sistemas Universidad de Zaragoza

  2. Configuración PC (software) apache_2.0.58-win32-x86-no_ssl.msi php-5.1.4 zip package.zip pecl-5.1.4-Win32 binaries.zip PHPDesigner mysql-essential-5.0.19-win32 mysql-query-browser-1.1.20-win phpMyAdmin-2.6.3-pl1.zip Apache_php Alberto Gimeno Arnal 2

  3. Configuración PC (Apache) Imprescindibles: Network Domain (Nombre_Dominio.com), Server Name (localhost o www.Nombre_Dominio.com) y Administrator's e-mail address. Manual. \windows\system32\drivers\etc\ hosts.sam Alberto Gimeno Arnal 3

  4. Configuración PC (php 5) Descomprimir en el directorio donde se ha instalado el servidor apache. Renombrar carpeta  PHP5. Localiza php5\*.dll’s y copialos \system32\ Configurar php.ini-dist  php.ini Alberto Gimeno Arnal 4

  5. Configuración PC (php.ini) register_globals = On(403) extension_dir = "C:\Servidor\PHP5\ext\" (475) Windows Extensions (580) ;extension=php_mysql.dll upload_tmp_dir = "C:\Servidor\PHP5\uploads\" upload_max_filesize= 2M(525-528) session.save_path = "C:\Servidor\PHP5\sesion\“ Alberto Gimeno Arnal 5

  6. Configuración PC (httpd.conf) LoadModule php5_module C:/Servidor/PHP5/php5apache2.dll (132) DocumentRoot(228) DirectoryIndex index.html index.htm index.php index.php3 index.php4 index.php5 index.phtml index.html.var (321) AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml (757) Alberto Gimeno Arnal 6

  7. PHP: Estilos de Etiqueta Estilo XML: <?php …. ?> Estilo corto: <? Echo ‘Hola Figura!’; ?> Estilo SCRIPT: <script language=‘php’>echo ‘Hola Figura!’; </script> Estilo ASP: <% echo ‘Hola Figura!’;%> Alberto Gimeno Arnal PHP 7

  8. PHP: Variables de formulario Estilo corto: $nombre Estilo intermedio: $_POST[‘nombre’] Estilo largo: $HTTP_POST_VARS[‘nombre’] PHP: Tipos de Variables Alberto Gimeno Arnal PHP 8

  9. PHP: Ámbito de las variables Superglobales. ($_POST, $_GET, $_SERVER, $_ENV) Globales. Constantes. Estáticas. Locales. Alberto Gimeno Arnal PHP 9

  10. PHP: Concatenación de cadenas <<< nombreVariable …….. (varias líneas) nombreVariable; $a = $b . $c; $a .= $d; $a .= “cadena de texto de 1 línea”; $a .= <<< nombreVariable ….. Funciones de salida: echo, print, printf Alberto Gimeno Arnal PHP 10

  11. PHP: Operadores Bit a bit (&, | , ^, <<, >>, ~) De comparación (==, ===, !=, <=, >=, ….) Lógicos (AND, &&, OR, ||, XOR, !) De incremento (++, --, ) Condicionales (if) Switch Bucles: while, do…while, for, foreach. Función Continue Alberto Gimeno Arnal PHP 11

  12. PHP: Información de variables Sizeof(), count() Isset(), is_array(), is_double(), is_int(), is_long(), unset() Matrices: array_count_values(ar), array_keys(arr), array_keys(arr, valor), array_values(arr) Alberto Gimeno Arnal PHP 12

  13. PHP: Clases y objetos class nombreC {....... definición de variables.......... constructores (opcional)......... definición de funciones... ....} Creación objeto: $nombre = new nombreC; Uso de propiedades: $nombre ->funcion(); Alberto Gimeno Arnal PHP 13

  14. PHP: Clases extendidas (herencia) class nombreHijo extends nombPadre{....... definición de variables........} Funciones definidas: method_exists(obj, func), get_class_vars(clase), get_class_methods(clas), get_object_var(obj) , Alberto Gimeno Arnal PHP 14

  15. PHP: Archivos Externos include(), require() include_once(), require_once() $v=get_included_files() $v=get_ required_files() Alberto Gimeno Arnal PHP 15

  16. PHP: Ficheros Externos $f=fopen(fichero,modo), fclose($f), feof($f), rewind($f), fseek($f,posicion), ftell($f) readfile(fichero), fgets($f,long), fgetc($f), fpassthru($f), fwrite($f,”txt”,pos),fputs($f,”txt”,pos) unlink(fichero) copy(fich1,fich2), rename(fich1,fich2) file_exists(fich), filesize(fich), filetype(fich),….. http://de3.php.net/manual/es/ref.filesystem.php Alberto Gimeno Arnal PHP 16

  17. PHP: Transferencia de ficheros $_FILES ó $HTTP_POST_FILES copy(fich1,fich2) move_uploaded_file(fich1, fich2) Compresión de ficheros  *.gz PHP: Imágenes dinámicas • php_gd2.dll • gif, jpeg, png, bmp, tiff, gráficos estadísticos. Alberto Gimeno Arnal PHP 17

  18. PHP: Cookies y sesiones setcookie(nom, val, exp) $_COOKIE, $HTTP_COOKIE_VARS session_start(), session_name('nombre'), session_id(), session_set/get_cookie_params(), unset($_SESSION) $_SESSION['var'], HTTP_SESSION_VARS['v'] Alberto Gimeno Arnal PHP 18

  19. PHP: Bases de datos (mysql) mysql_connect, mysql_close, mysql_select_db, mysql_query, mysql_fetch_row, mysql_fetch_array, mysql_num_rows, mysql_num_fields, mysql_field_table, mysql_field_type, mysql_field_flags, mysql_field_name, mysql_field_len, mysql_free_result, mysql_db_name, mysql_db_query, mysql_list_dbs,….. Alberto Gimeno Arnal PHP 19

  20. PHP: Conexión (mysql) $c=mysql_connect(“localhost”, “root”, “mysql”); mysql_select_db(“criogenia", $c); $r=mysql_query(“consulta sql;", $c); While($t=mysql_fetch_row ($r)){ foreach($t as $v){ print $v; } } Alberto Gimeno Arnal PHP 20

  21. PHP: Imagenes Header(“Content-type:image/jpeg”) Crearla: Imagecreate (ancho, largo) Dibujarla: imagecolorallocate, Imagefill, imagerectangle, imagerectangle, imagefilledrectangle, imagefilledpolygon,… Enviarla: Imagejpeg o Imagepng Destruirla: Imagedestroy Alberto Gimeno Arnal PHP 21

  22. PHP: Generación pdf extension=php_pdf.dll + Info: http://www.pdflib.com/products/pdflib-family/pdflib/ FPDF.php, fuentes tipográficas. $miPDF = new FPDF(orient, unid, dim) Addpage(), Output(nomb,dest[I|D|F]) Alberto Gimeno Arnal PHP 22

  23. PHP: Trabajar con Flash extension=php_ming.dll Shockwave Player. header("Content-type:application/x-shockwave-flash"); SWFAction, SWFBitmap, SWFButton, SWFDisplayItem, SWFFill, SWFFont, SWFGradient, SWFMorph, SWFMovie, SWFShape, SWFSprite, SWFText, SWFTextField. Alberto Gimeno Arnal PHP 23

  24. BIBLIOGRAFIA: Desarrollo Web con PHP y MySQL Ed.: ANAYA Multimedia Domine PHP y MySQL Ed.: Ra-Ma MySQL 5.0 Reference Manual (http://dev.mysql.com/doc/refman/5.0/es/index.html) Manual oficial de PHP (http://www.php.com/) Alberto Gimeno Arnal 24

More Related