如何在 codeigniter 中获得 $_POST 完整值而不对其进行任何清理操作?
我在 codeigniter 中有一个类似这样的控制器:
class ABC extends MX_Controller {
...
...
...
.
.
.
...
...
public function getTestPostData(){
print_r($_POST);
}
}
在 getTestPostData
中,当我打印 $_POST
时,我需要完整的 $_POST
数据,而不进行任何类型的清理。我无法在 config.php
中设置 $config['global_xss_filtering'] = FALSE;
我该如何实现?
编辑:
在发布数据中,我发送一些带有一些 (script) 标签的 HTML 内容,但是当我使用
$ 在控制器中打印数据时this->input->post("content")
(script) 标签被 [removed] 标签替换。当 global_xss_filtering 为 TRUE 时,会发生这种情况。我无法将此值更改为 FALSE。
我希望现在问题已经清楚了。
I have a controller something like this in codeigniter:
class ABC extends MX_Controller {
...
...
...
.
.
.
...
...
public function getTestPostData(){
print_r($_POST);
}
}
In getTestPostData
when i print $_POST
i need full $_POST
data without any sanitization of any kind. I can't set $config['global_xss_filtering'] = FALSE;
in config.php
How can i achieve that?
Edit:
In post data i am sending some HTML content with some <script>
(script) tags, but when i print the data in my controller using $this->input->post("content")
the <script>
(script)tags gets replace by [removed] tags. This happens when the global_xss_filtering is TRUE. I can't change this value to FALSE.
I hope now the question is clear.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个,在我的测试中,即使在完全取消
$_POST
后它仍然有效。Try this, in my tests it worked even after unsetting
$_POST
completely.你不能设置 $config['global_xss_filtering'] = FALSE;在 config.php 中?
那么如果你无法访问 core/input.php 类
并从中删除 _POST
或将 var $xss_clean 更改为 false ,
这样您就无法查看未过滤的帖子
数据
you can't set $config['global_xss_filtering'] = FALSE; in config.php?
then if you can't access core/input.php class
and remove _POST from it
or change the var $xss_clean to false like this
then you can't view the post data unfiltered from
that's all
如果您有 CI v. 2+,请尝试以下操作:
创建一个扩展 CI_Security 的新核心文件并覆盖
xss_clean
函数,如下所示:编辑: 我刚刚测试了这个,它作品。供参考。
If you have CI v. 2+ try the following:
Create a new Core file that extends CI_Security and overwrite the
xss_clean
function like so:EDIT: I just tested this and it works. FYI.