Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Exception.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://zjzit.cn>
  10. // +----------------------------------------------------------------------
  11. namespace think;
  12. class Exception extends \Exception
  13. {
  14. /**
  15. * 保存异常页面显示的额外Debug数据
  16. * @var array
  17. */
  18. protected $data = [];
  19. /**
  20. * 设置异常额外的Debug数据
  21. * 数据将会显示为下面的格式
  22. *
  23. * Exception Data
  24. * --------------------------------------------------
  25. * Label 1
  26. * key1 value1
  27. * key2 value2
  28. * Label 2
  29. * key1 value1
  30. * key2 value2
  31. *
  32. * @access protected
  33. * @param string $label 数据分类,用于异常页面显示
  34. * @param array $data 需要显示的数据,必须为关联数组
  35. */
  36. final protected function setData($label, array $data)
  37. {
  38. $this->data[$label] = $data;
  39. }
  40. /**
  41. * 获取异常额外Debug数据
  42. * 主要用于输出到异常页面便于调试
  43. * @access public
  44. * @return array 由setData设置的Debug数据
  45. */
  46. final public function getData()
  47. {
  48. return $this->data;
  49. }
  50. }