thinkphp和rbac的一些坑

thinkphp是国内的一款php框架,在很早之前就想学这个的,不过要忙其他事。这次做东西的时候要用到它,一使用之后发现也不过如此。问题还是不少的。

1.Thinkphp的Action输出的JSON在IE中提示下载

在Thinkphp\lib\core\Action.class.php中 将两处 “header('Content-Type:application/json; charset=utf-8');” 修改为 “header('Content-Type:text/html; charset=utf-8');

2.Prototype无法取得form中的提交控件

具体表现为 Form.serialize方法返回为空,无法send

// 发送表单Ajax操作,暂时不支持附件上传
sendForm: function(formId, url, response, target, tips, effect)
{
vars = Form.serialize(formId);
this.send(url, vars, response, target, tips, effect);
}

其原因时form和内部input不能嵌套在table表格中。

在Thinkphp的rbac中是有不少错误的,有个就是上述的原因。在Public\Tpl\user\edit.html中form就嵌套在table中了。

还有个问题是,重置密码的input没有指定reserPWD的id。

3.sendForm is not defined

<input type="button" value="保 存" onclick="sendForm('form1','/rbac/User/update/')" class="small submit">
Uncaught ReferenceError: sendForm is not defined

其错误是因为sendForm方法的调用需要引入 ThinkAjax,变成ThinkAjax.sendForm

4.rbac分页无法跳转,?&=2 没有键

需要在config.php中添加 'VAR_PAGE'=>'p'

0 条评论