跳转到主要内容
你行网

Main navigation

  • 首页
  • Drupal
  • 编程与开发
  • 数据库
  • 操作系统与应用
  • 服务器与运维
  • 社区
User account menu
  • 登录

面包屑

  1. 首页
  2. Drupal 7 高级教程

3. Drupal 7 高级教程 - 错误处理

由 hrs, 13 八月, 2019
标签
drupal

在本章中,我们将研究Drupal错误处理,以便在Drupal站点上管理错误消息。

错误处理是一个检测和查找错误分辨率的过程。它可以是编程应用程序错误或可传递错误。

以下步骤描述了如何在Drupa中管理错误消息 -

步骤1 - 转到“ 配置”,然后单击“ 记录和错误”。

drupal-error-handling-step(1).jpg

步骤2 - 将显示“ 记录和错误”页面,如以下屏幕所示。

drupal-error-handling-step(2).jpg

以下是前面屏幕中显示的字段的详细信息 -

  • 要显示的错误消息 - 它指定要在Drupal站点上显示的错误消息。

    • 无 - 此选项不显示任何错误消息。

    • 错误和警告 - 此选项仅显示与错误和警告相关的消息。

    • 所有消息 - 此选项指定要在站点上显示的所有类型的错误消息,例如错误,警告等。

  • 要保留的数据库日志消息 - 它指示要在数据库日志中保留的最大消息数。

Drupal使用_drupal_exception_handler($ exception)函数来处理站点上的错误。这些错误不会包含在try / catch块中。异常处理程序退出时,脚本不会执行该函数。

_drupal_exception_handler的代码如下 -

function _drupal_exception_handler($exception) {
   require_once DRUPAL_ROOT . '/includes/errors.inc';
   try {
      // display the error message in the log and return the error messages to the user
      _drupal_log_error(_drupal_decode_exception($exception), TRUE);
   }
   catch (Exception $excp2) {
      // Another uncaught exception was thrown while handling the first one.
      // If we are displaying errors, then do so with no possibility of 
         a further uncaught exception being thrown.
         
      if (error_displayable()) {
         print '<h1>Additional uncaught exception thrown while handling exception.</h1>';
         print '<h2>Original</h2> <p>'. _drupal_render_exception_safe($exception).'</p>';
         print '<h2>Additional</h2> <p>'. _drupal_render_exception_safe($excp2).'</p><hr/>';
      }
   }
}

必须在每个Drupal请求上使用该函数。该函数出现在文件include / bootstrap.inc中的第2328行。

有两个对_drupal_exception_handler的字符串引用,例如bootstrap.inc文件中存在_drupal_bootstrap_configuration(),errors.inc文件中存在_drupal_get_last_caller。这两个文件都存在于'includes'文件夹中。

评论

  • 登录或注册以发表评论
  • 155 次浏览

书籍遍历链接: 3. Drupal 7 高级教程 - 错误处理

  • 2. Drupal高级教程 - 网站搜索
  • 向上
  • 4. Drupal 7 高级教程- 多语言内容

最新文章

  • 内容审核通知 content_moderation_notifications 模块简介
  • 调度程序 scheduler 模块简介
  • 工作流当中的草稿,已发布,很好理解,已归档是怎么理解。
  • 你行网 https://www.dwoke.com seo 关键词
  • brew 是什么命令
  • drupal 9 或 drpal 10 国内内容分享模块 Will Nice social share
  • Views Slideshow - Views Vanilla JavaScript Slideshow (VVJS) 简介和安装方法
  • drupal 11 安装statistics 统计模块
  • drupal11 扩展中找不到Statistics模块
  • drupal11 设置中的“总结摘要”和“切边的” 有什么区别

教程节点

  • 1. Drupal高级教程 - URL别名
  • 2. Drupal高级教程 - 网站搜索
  • 3. Drupal 7 高级教程 - 错误处理
  • 4. Drupal 7 高级教程- 多语言内容
  • 5. Drupal 高级教程- 触发器和动作
  • 6. Drupal 高级教程- 社交网络
  • 7. Drupal高级教程 - 国际化
  • 8. Drupal 高级教程- 扩展
  • 9. Drupal 高级教程 - 默认模块
  • 10. Drupal 高级教程- 窗格模块
  • 11. Drupal高级教程 - 书籍模块
  • 12. Drupal 高级教程- 聚合器模块
  • 13. Drupal 高级教程- 联系人模块
  • 14. Drupal 高级教程- 表单模块
  • 15. Drupal高级教程 - 民意调查模块
  • 16. Drupal 高级教程- 网站安全

标签云

adsenseAIapacheaptbadblocksbreadcrumbbrewcentoscertbotckeditorcommandcomposercookiecsharpCSScurlC语言DDEVdiffdnsdockerDreamweaverDrupaldrupal 7drupal 8drupal 9drupal10drupal 11drushExcelfirewalldfirmwareflameshotformgimpgitgzipHTMLHTML5httpdhttp验证inputipjavaJavaScriptJavaSrciptkernelKVMLinuxmavenmbstringmod_expires 模块Mysqlnerdtreenetstatnetworknginxnpmpasswordphpphpmyadminphp扩展RFIDRSSselinuxSEOsharesimple_adsensesshsslStatisticssuperfishsurroundtagcloudstitleubuntuuploadprogressvimVPNVUEWireGuardwpsxdebugyoutubeyumzip主题(theme)二进制五笔分类术语压缩解压哈希值声音字段密码工作流快捷键摄影权限果树种植标签优化模块(module)源地址版本号电子秤电脑基础电脑技巧短信验证端口简介算法网站备份网站运营翻译英语表单视图(views)计算机基础赚钱超五类线网线邮件验证重定向重定向,301错误颜色

相关文章

RSS源

关于我们

  • 你行网简介
  • 关于我们
  • 版权声明

网站相关

  • 社区论坛
  • 网址导航
  • 网站地图
  • 联系我们

友情链接

  • 英文学习

友情链接2

  • drupal 大学
  • 水滴间
  • 爱码网
  • Apache

友情链接3

  • MySQL
  • php
  • drupalcode

友情链接4

  • Drupal 中国
  • Drupal 老葛
  • 宁浩网
  • drupal 台湾
Copyright © 2019 - 2021 你行网 版权所有  粤ICP备19072650号-1