方法= QUOT; POST"将'。'更改为'_' [英] method="POST" changes '.' to '_'

查看:87
本文介绍了方法= QUOT; POST"将'。'更改为'_'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用POST将数据传输到另一个页面。当我这样做时,''。''字符会转换为_。例如:


#index.html:

< form action =" test.php" method =" post">

< input type =" submit" name =" filename.txt">

< / form>


#test.php

< html> ;

<?php

var_dump($ _POST);

?>

< / html> ;


显示:


array(1){[" filename_txt"] = string(12)" Submit Query" }


即''filename.txt''更改为''filename_txt''

如何阻止此行为?

I am trying to use POST to transfer data to another page. When I do
this, ''.'' characters get converted to"_". For example:

#index.html:
<form action="test.php" method="post">
<input type="submit" name="filename.txt">
</form>

#test.php
<html>
<?php
var_dump( $_POST );
?>
</html>

This displays:

array(1) { ["filename_txt"]= string(12) "Submit Query" }

ie ''filename.txt'' is changed to ''filename_txt''
How can I stop this behaviour?

推荐答案

_POST);

?>

< / html>


显示:


array(1){[" filename_txt"] = string(12)" Submit Query" }


即''filename.txt''更改为''filename_txt''

如何阻止此行为?

_POST );
?>
</html>

This displays:

array(1) { ["filename_txt"]= string(12) "Submit Query" }

ie ''filename.txt'' is changed to ''filename_txt''
How can I stop this behaviour?


2006年7月6日15:07:59 -0700,Robert S < ro ********************** @ gmail.com>

写道:
On 6 Jul 2006 15:07:59 -0700, "Robert S" <ro**********************@gmail.com>
wrote:

>我正在尝试使用POST将数据传输到另一个页面。当我这样做时,''。''字符会转换为_。例如:

#index.html:
< form action =" test.php" method =" post">
< input type =" submit" name =" filename.txt">
< / form>

#test.php
< html>
<?php
var_dump(
>I am trying to use POST to transfer data to another page. When I do
this, ''.'' characters get converted to"_". For example:

#index.html:
<form action="test.php" method="post">
<input type="submit" name="filename.txt">
</form>

#test.php
<html>
<?php
var_dump(


_POST);
?>
< / html>

显示:

array(1){[" filename_txt"] = string(12)" Submit Query" }'

ie''filename.txt''更改为''filename_txt''
如何阻止此行为?
_POST );
?>
</html>

This displays:

array(1) { ["filename_txt"]= string(12) "Submit Query" }

ie ''filename.txt'' is changed to ''filename_txt''
How can I stop this behaviour?



你必须修补PHP。


参见main / php_variables.c,php_register_variable_ex

(PHP 5.1.4第92行):


/ *确保我们在变量名中没有空格或点(不是二进制的)

safe)* /

for(p = var; * p; p ++){

if(* p ==''''|| * p = =''。''){

* p =''_'';

}否则if(* p ==''[''){

is_array = 1;

ip = p;

* p = 0;

休息;

}

}

var_len = p - var;


-

Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space ::磁盘和FTP使用情况分析工具

You''d have to patch PHP.

See main/php_variables.c, php_register_variable_ex
(line 92 in PHP 5.1.4):

/* ensure that we don''t have spaces or dots in the variable name (not binary
safe) */
for (p = var; *p; p++) {
if (*p == '' '' || *p == ''.'') {
*p=''_'';
} else if (*p == ''['') {
is_array = 1;
ip = p;
*p = 0;
break;
}
}
var_len = p - var;

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool


这篇关于方法= QUOT; POST&QUOT;将'。'更改为'_'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆