通知设置 新通知
【报Bug】在某个模块下加入钩子tags.php文件后,调用这个钩子会被执行两次
回复cooltea521 发起了问题 • 1 人关注 • 0 个回复 • 3272 次浏览 • 2023-06-19 22:42
ZBuilder 构建表单 单选项Radio 设定default属性(默认值)不起效
momo 发表了文章 • 0 个评论 • 1178 次浏览 • 2020-07-07 10:17
问题代码:application\common\builder\form\items\radio.html
{eq name="key" value="$form[type].value|default=''"}checked{/eq}应该改为:
{eq name="key" value="$form[type].default|default=''"}checked{/eq}
Bug原因: 把default误写成value 查看全部
{eq name="key" value="$form[type].value|default=''"}checked{/eq}应该改为:
{eq name="key" value="$form[type].default|default=''"}checked{/eq}
Bug原因: 把default误写成value 查看全部
问题代码:application\common\builder\form\items\radio.html
Bug原因: 把default误写成value
{eq name="key" value="$form[type].value|default=''"}checked{/eq}
应该改为:
{eq name="key" value="$form[type].default|default=''"}checked{/eq}
Bug原因: 把default误写成value
$this->error()无法跳转的坑!
delgo 发表了文章 • 0 个评论 • 1631 次浏览 • 2020-03-26 21:02
因为想做一个表单提交后发现某错误后跳转出去后台的功能,所以用到了$this->error($msg,$url),结果发现跳转完全不起作用。但是$this->success($msg,$url)跳转却可以。
看了看thinkphp官方的代码,没有发现自己传递参数时有啥错误。
代码在thinkphp/traits/controller/jump.php中。
/**
* 操作错误跳转的快捷方法
* @access protected
* @param mixed $msg 提示信息
* @param string $url 跳转的URL地址
* @param mixed $data 返回的数据
* @param integer $wait 跳转等待时间
* @param array $header 发送的Header信息
* @return void
*/
protected function error($msg = '', $url = null, $data = '', $wait = 3, array $header = [])
{
$type = $this->getResponseType();
if (is_null($url)) {
$url = $this->app['request']->isAjax() ? '' : 'javascript:history.back(-1);';
} elseif ('' !== $url) {
$url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app['url']->build($url);
}
$result = [
'code' => 0,
'msg' => $msg,
'data' => $data,
'url' => $url,
'wait' => $wait,
];
if ('html' == strtolower($type)) {
$type = 'jump';
}
$response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app['config']->get('dispatch_error_tmpl')]);
throw new HttpResponseException($response);
}
然后再看thinkphp文档,发现有一句error方法会自动判断当前请求是否属于Ajax请求,如果属于Ajax请求则会自动转换为default_ajax_return配置的格式返回信息。 success在Ajax请求下不返回信息,需要开发者自行处理。围绕这个找了半天,发现能力有限,确实翻找不到,最终在dolphin.js260行左右找到了代码。
tips(msg, 'danger');对表单提交时候的$this->error();有效,于是在下面加了一句。
if(res.url){
setTimeout(function(){
parent.location.href = res.url;
},res.wait*1000)
}这下可以实现了,但是其实根本的问题没能解决,也算是个BUG吧,请官方看看是哪里的问题。 查看全部
看了看thinkphp官方的代码,没有发现自己传递参数时有啥错误。
代码在thinkphp/traits/controller/jump.php中。
/**
* 操作错误跳转的快捷方法
* @access protected
* @param mixed $msg 提示信息
* @param string $url 跳转的URL地址
* @param mixed $data 返回的数据
* @param integer $wait 跳转等待时间
* @param array $header 发送的Header信息
* @return void
*/
protected function error($msg = '', $url = null, $data = '', $wait = 3, array $header = [])
{
$type = $this->getResponseType();
if (is_null($url)) {
$url = $this->app['request']->isAjax() ? '' : 'javascript:history.back(-1);';
} elseif ('' !== $url) {
$url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app['url']->build($url);
}
$result = [
'code' => 0,
'msg' => $msg,
'data' => $data,
'url' => $url,
'wait' => $wait,
];
if ('html' == strtolower($type)) {
$type = 'jump';
}
$response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app['config']->get('dispatch_error_tmpl')]);
throw new HttpResponseException($response);
}
然后再看thinkphp文档,发现有一句error方法会自动判断当前请求是否属于Ajax请求,如果属于Ajax请求则会自动转换为default_ajax_return配置的格式返回信息。 success在Ajax请求下不返回信息,需要开发者自行处理。围绕这个找了半天,发现能力有限,确实翻找不到,最终在dolphin.js260行左右找到了代码。
tips(msg, 'danger');对表单提交时候的$this->error();有效,于是在下面加了一句。
if(res.url){
setTimeout(function(){
parent.location.href = res.url;
},res.wait*1000)
}这下可以实现了,但是其实根本的问题没能解决,也算是个BUG吧,请官方看看是哪里的问题。 查看全部
因为想做一个表单提交后发现某错误后跳转出去后台的功能,所以用到了$this->error($msg,$url),结果发现跳转完全不起作用。但是$this->success($msg,$url)跳转却可以。
看了看thinkphp官方的代码,没有发现自己传递参数时有啥错误。
代码在thinkphp/traits/controller/jump.php中。
然后再看thinkphp文档,发现有一句
看了看thinkphp官方的代码,没有发现自己传递参数时有啥错误。
代码在thinkphp/traits/controller/jump.php中。
/**
* 操作错误跳转的快捷方法
* @access protected
* @param mixed $msg 提示信息
* @param string $url 跳转的URL地址
* @param mixed $data 返回的数据
* @param integer $wait 跳转等待时间
* @param array $header 发送的Header信息
* @return void
*/
protected function error($msg = '', $url = null, $data = '', $wait = 3, array $header = [])
{
$type = $this->getResponseType();
if (is_null($url)) {
$url = $this->app['request']->isAjax() ? '' : 'javascript:history.back(-1);';
} elseif ('' !== $url) {
$url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app['url']->build($url);
}
$result = [
'code' => 0,
'msg' => $msg,
'data' => $data,
'url' => $url,
'wait' => $wait,
];
if ('html' == strtolower($type)) {
$type = 'jump';
}
$response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app['config']->get('dispatch_error_tmpl')]);
throw new HttpResponseException($response);
}
然后再看thinkphp文档,发现有一句
error方法会自动判断当前请求是否属于Ajax请求,如果属于Ajax请求则会自动转换为default_ajax_return配置的格式返回信息。 success在Ajax请求下不返回信息,需要开发者自行处理。围绕这个找了半天,发现能力有限,确实翻找不到,最终在dolphin.js260行左右找到了代码。
tips(msg, 'danger');对表单提交时候的$this->error();有效,于是在下面加了一句。
if(res.url){这下可以实现了,但是其实根本的问题没能解决,也算是个BUG吧,请官方看看是哪里的问题。
setTimeout(function(){
parent.location.href = res.url;
},res.wait*1000)
}