这是不是CI的漏洞?
本帖最后由 lamp_小范 于 2013-4-21 05:28 编辑有一个表单验证, 控制器和方法分别叫 collectersave_basic_novel
验证方法为$this->from_validation->run()
表单验证规则写在了配置文件, 规则为
"collecter/save_basic_novel" => array(
array(
"field" => "category_id",
"label" => "分类",
"rules" => "required|numeric|callback__check_category",
),
array(
"field" => "novel_name",
"label" => "小说名",
"rules" => "required",
),
array(
"field" => "novel_author",
"label" => "作者",
"rules" => "required",
),
array(
"field" => "novel_from_url",
"label" => "小说地址",
"rules" => "required",
),
array(
"field" => "novel_intro",
"label" => "小说介绍",
"rules" => "required",
),
array(
"field" => "novel_source_type",
"label" => "来源网站",
"rules" => "required|callback_check_source",
),
array(
"field" => "novel_status",
"label" => "小说状态",
"rules" => "required|numeric",
),
),
数据是通过ajax的post方法提交的. 提交数据为
category_id1
novel_author血法师
novel_from_urlhttp://m.motie.com/book/20204
novel_intro暂无介绍~
novel_name校园美女杀手
novel_source_typemotie
novel_status1
然后看到ajax返回的json数据正是正常的, 但是json数据之前还返回了如下信息
A PHP Error was encounteredSeverity: 4096
Message:Object of class stdClass could not be converted to string
Filename: core/Common.php
Line Number: 531
我始终搞不明白为什么会这样... 我的CI是2.1的
求指教.
求各位大神拯救一下我吧, 我到现在都还解决啊.... 应该是你的其他代码导致的,这是 PHP 的警告,跟 CI 无关。
贴一下代码吧,贴的越多越好。 Hex 发表于 2013-4-22 19:21 static/image/common/back.gif
应该是你的其他代码导致的,这是 PHP 的警告,跟 CI 无关。
贴一下代码吧,贴的越多越好。 ...
一起贴上来吧。 Hex 发表于 2013-4-22 19:21 static/image/common/back.gif
应该是你的其他代码导致的,这是 PHP 的警告,跟 CI 无关。
贴一下代码吧,贴的越多越好。 ...
问题已经搞定, 就是那个$this->input->post("category_id")应该写在$this->form_validation->run()前面. 不然接收不到值, 然后传给model的参数就是空的... 我到现在都疑惑为什么只有写在前面才能接收到? lamp_小范 发表于 2013-4-26 00:25 static/image/common/back.gif
问题已经搞定, 就是那个$this->input->post("category_id")应该写在$this->form_validation->run()前面....
不应该啊,表单验证类自己会获取 post 信息。
你的 CI 是什么版本?我这里是OK的。 现在最新的版本... 2.1.3
CI还不止这一个奇怪点, 还有其他很多, 我都不列举, 都想不起大概了, CI是我用过最诡异的, 也是用着最顺手的,就是因为文档的原因. 最诡异的 最顺手的,哪只能说明你是一个受虐狂 lamp_小范 发表于 2013-4-26 16:26 static/image/common/back.gif
现在最新的版本... 2.1.3
CI还不止这一个奇怪点, 还有其他很多, 我都不列举, 都想不起大概了, CI是我用 ...
诡异。。。
我用着一点都不诡异,没有任何异常行为。
诡异,我建议你阅读下源码,很多时候都是因为很不起眼的小问题,导致的诡异问题。 不测试500遍,绝对不怀疑框架{:soso_e113:}
页:
[1]