我正在使用 codeigniter 制作一个网站。
如果用户在他的评论中写入 {memory_usage}
2.75MB
将显示给他。它不会给 codeigniter 编写的代码带来安全漏洞吗?有什么合理(和常见)的方法来防止此类问题?
最佳答案
将此添加到您的 Controller :
$this->output->parse_exec_vars = FALSE;
解析执行变量
CodeIgniter will parse the pseudo-variables
{elapsed_time}
and{memory_usage}
in your output by default. To disable this, set the$parse_exec_vars
class property toFALSE
in your controller.
更新,可能需要修改/system/core/Output.php
改变:
protected $parse_exec_vars = TRUE;
收件人:
public $parse_exec_vars = TRUE;
现在您可以在 Controller 中将 $this->output->parse_exec_vars
设置为 FALSE
。
关于codeigniter 基准 {memory_usage} 安全,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18341722/