La dirección y el marco de argumentos [cerrado]

How should look the address and the arguments in the framework?

Do you write:

¿Es bueno?

Do better the record:

I would ask for example, as is the intermediate frameworks

preguntado el 08 de noviembre de 11 a las 11:11

Are you asking how a specific framework handles its URLs, or are you implementing a new framework and ask which way is better? -

3 Respuestas

The framework I'm most experienced with (CodeIgniter) mainly uses this approach, calling it "url segmentation"

The URL is retrieved through $_SERVER array and then exploded ("/") and a master class (which acts as an entry point) assigns the different chunks to the competend handler (first segment to controller, second to a method, the rest to the said method as an array of parameters; you might use function_get_args() there, for example, to retrieve them)

Another common options, and easier to implement, is using query strings

which you can easily retrieve with the $_GET array and rewrite in in .htaccess to look "Prettier". That's how pretty urls are there for :)

respondido 08 nov., 11:16

Actually this should not play a role for you. However a framework does this, it should offer you access to both controllers and arguments.

El primer ejemplo

has the benefit that you can better distinguish between the command controller/method and it's arguments arg=1&arg=2 so this looks more affine to HTTP here.

Some will tell you that these URLs are not SEO friendly, but we see more and more search engines that make use of the semantics here, so the full story is that both variants are SEO friendly and only if you mix both concepts, you will gain maximum control for SEO.

In any case should a framework allow multiple ways so you're able to make use of what you think is most useful to your needs. That's normally called routing.

respondido 08 nov., 11:16

Well, generally frameworks has url pattern like

Esta es una mejor manera

respondido 08 nov., 11:15

ok but i cant get arguments in $_GET - zyeu

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.