Saltar al contenido ForoHackers

PHP: start here

PHP
#3073 · · Citar · Denunciar

PHP is a server-side scripting language built for the web: a script runs per request, reads input, talks to a database and returns HTML or data. It powers a very large share of existing sites and content management systems. Modern PHP is a typed, object-oriented language with a mature package ecosystem, quite unlike its early reputation.

Key concepts

  • Request lifecycle: each request starts a fresh script, with superglobals holding input and no state carried over by default.
  • Dynamic typing with type declarations: values convert freely, but declared types make code safer.
  • Classes, interfaces and traits: the object model of current PHP, with namespaces and autoloading.
  • Arrays: one flexible structure serves as list and dictionary.
  • Database access: prepared statements through a database abstraction layer.
  • Composer and frameworks: packages and frameworks provide routing, templating and structure.

Vocabulary

  • Superglobal: built-in variables such as the request data and the session.
  • Session: server-side state tied to a visitor by a cookie.
  • Autoloading: classes load when first used, from a naming convention.
  • Template: a file mixing markup with small bits of code to render output.

What to study, in order

  1. Basic syntax, arrays and functions, running scripts from the command line.
  2. Handle a form: read input, validate it, escape output, and store it with prepared statements.
  3. Classes, namespaces and Composer; split code into reusable pieces.
  4. Sessions, authentication and the common security pitfalls such as injection and cross-site scripting.
  5. A framework's routing, templates and testing.
  6. Deploy to a server and read its error logs.

Related tags

#backend #web-security #sql #web-frameworks

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder