我正在使用 CodeIgniter v 3.1.4。在其中一种形式中,我有一个文本框用于将网址(如 https://stackoverflow.com/questions/ask 、 http://google.com 等)保存到 MySql 数据库中。
在保存之前,我正在清理网址,如下所示:
构造函数内部:
$this->load->helper('security');
内部添加功能:
$hlt_url = $this->security->xss_clean($this->input->post('txtHLnk'));
$hlt_hlines = $this->security->xss_clean($this->input->post('txtAreaHLine'));
当我在文本框中输入简单/纯字符串时,数据会保存在数据库中,但是当我在文本框中输入网址时,数据不会保存在数据库中,也不会显示任何错误消息。
请用代码解释我做错了什么。谢谢
最佳答案
$hlt_url = $this->input->post('txtHLnk', true);
$hlt_hlines = $this->input->post('txtAreaHLine', true);
我认为 kthis 是最新版本中清理输入的新实现。
关于php - “安全”助手在 CodeIgniter 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46359570/