在新服务器上格式化GET序列化数据
I had set up a demo web app on my personal server. When a user submits the info on the form, the array of info is sent through the form. It worked fine on my server. When I moved it to a new server, it no longer sends the correct information. I noticed the string is slightly different. Is there some sort of setting I need to change on the new server?
For both sites, I chose February and submitted the form.
The string that gets passed on the old server:
months=a%3A1%3A%7Bi%3A0%3Bs%3A1%3A"2"%3B%7D
The string that gets passed on the new server:
months=a%3A1%3A%7Bi%3A0%3Bs%3A1%3A%5C"2%5C"%3B%7D
The data is collected from the get with:
$months = $_GET['months'];
$dates = unserialize(urldecode($months));
The data is added to the form as a hidden field using this variable:
$dateserial = htmlspecialchars(serialize($dates));
我在个人服务器上设置了一个演示网络应用程序。 当用户在表单上提交信息时,信息数组将通过表单发送。 它在我的服务器上工作正常。 当我将其移动到新服务器时,它不再发送正确的信息。 我注意到字符串略有不同。 我需要在新服务器上更改某种设置吗? p>
对于这两个站点,我选择了二月并提交了表单。 p>
在旧服务器上传递的字符串: p>
months = a%3A1%3A%7Bi%3A0%3Bs%3A1%3A“2”%3B%7D
pre>
在新服务器上传递的字符串: p>
months = a%3A1%3A%7Bi%3A0% 3Bs%3A1%3A%5C“2%5C”%3B%7D
code> pre>
数据来自get with: p>
$ months = $ _GET ['months'];
$ dates = unserialize(urldecode($ months));
code> pre>
数据 使用此变量将表单作为隐藏字段添加到表单中: p>
$ dateserial = htmlspecialchars(serialize($ dates));
code> pre> \ n div>
magic_quotes_gpc
is enabled in php.ini
on the new server and "magically" escaping quotes with a \
which is translated into %5C
by urlencode
.
So turn it off.