问题描述
我是新来的计算器和codeIgniter和我目前正在尝试对我已经在互联网上找到一些简单的code的例子,为了得到一个开始。一个我的工作,现在是它使用CI和Ajax(jQuery的)一起保存在一个数据库中的表单的输入,然后显示最近他们在同一页面表单上的表单。如果我迷惑你这是从<一个4.7应用实例href="http://devsnippets.com/article/getting-started-with-$c$cigniter-and-how-to-create-all-those-great-apps.html"相对=nofollow>此处。最初的源$ C $ C谎言的。如果你打开全球XSS过滤的配置/ config.php文件
你将不必使用XSS清除它的。您可以通过使用清洁的,后由岗位的基础 $这个 - &GT;输入 - &GT;后期(名称,真);
Now, inspecting your controller...please refrain from using $_POST. CodeIgniter provides you with $this->input->post()
as part of the Input Library. If you turn on Global XSS filtering in config/config.php
you won't have to xss clean it either. You can clean on a post-by-post basis by using $this->input->post('name', true);
我建议这个代替:
function add(){
$m = $this->input->post('message', true);
if($m){
$this->Message_model->add($m);
}
}
这篇关于codeIgniter Ajax表单 - 提交表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!