mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 07:32:48 +08:00
改进验证异常类的错误信息和模板输出 支持批量验证的错误信息抛出
This commit is contained in:
@@ -13,20 +13,21 @@ namespace think\exception;
|
|||||||
|
|
||||||
class ValidateException extends \RuntimeException
|
class ValidateException extends \RuntimeException
|
||||||
{
|
{
|
||||||
protected $error;
|
protected $error;
|
||||||
|
|
||||||
public function __construct($error)
|
public function __construct($error)
|
||||||
{
|
{
|
||||||
$this->error = $error;
|
$this->error = $error;
|
||||||
}
|
$this->message = is_array($error) ? implode("\n\r", $error) : $error;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取验证错误信息
|
* 获取验证错误信息
|
||||||
* @access public
|
* @access public
|
||||||
* @return array|string
|
* @return array|string
|
||||||
*/
|
*/
|
||||||
public function getError()
|
public function getError()
|
||||||
{
|
{
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -292,7 +292,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<h2>[<?php echo $code; ?>] <?php echo sprintf('%s in %s', parse_class($name), parse_file($file, $line)); ?></h2>
|
<h2>[<?php echo $code; ?>] <?php echo sprintf('%s in %s', parse_class($name), parse_file($file, $line)); ?></h2>
|
||||||
</div>
|
</div>
|
||||||
<div><h1><?php echo htmlentities($message); ?></h1></div>
|
<div><h1><?php echo nl2br(htmlentities($message)); ?></h1></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user