1
I did a serialization of an object in .php
whose result is very different from the ordinary:
example.com/script.php? first name=joao&last name=silva&endereco=rua+dos+bobos+numero+zero&cpf=11111111111111`)
This being the result:
example.com.php? query=O:8:"Query":4:{s:10:"resultType";s:8:"products";s:6:"search";s:12:"lapis%20pen";s:6:"start";N;s:9:"records";N;}
Code:
$string = serialize($consulta);
$url = 'Location:'.'exibir.php?consulta='.$string;
header($url);
What’s inside the object:
Consulta Object ( [resultType] => produtos [search] => lapis caneta [inicio] => [registros] => )
,@bfavaretto see the result
exibir.php?resultType=produtos&search=lapis+caneta
the representation is correct? how can I store it directly in the corresponding object?– Ricardo
Yes, that’s correct. You can undo the operation with parse_str or parse_url depending on what you pass. Take a look at the documentation of these functions in the PHP manual.
– bfavaretto
Okay, this form of object passage is the most efficient and correct way?
– Ricardo
It is the only way to pass data via querystring (if I understand what you are asking...)
– bfavaretto
Yes the object contains values to be consulted in a BD
– Ricardo
why not send normally without serialize?
– Daniel Omine