QQ咨询 官方微信

添加微信好友

官方小程序

百度小程序

微信小程序

头条小程序

关于我们

帝国cms

帝国cms系统提示信息框printerror()函数介绍

 shitouadmin  2024-05-27 22:22:37
printerror()函数
功能:系统提示信息函数,根据传入的参数提示相关信息,并跳转到指定地址。
版本:7.2 7.5
语法:printerror($error,$gotourl,$ecms,$noautourl,$novar)
位置:/e/class/connect.php  200行

函数详细代码:
  1. //错误提示 
  2. function printerror($error="",$gotourl="",$ecms=0,$noautourl=0,$novar=0){ 
  3.     global $empire,$editor,$public_r,$ecms_config; 
  4.     if($editor==1){$a="../";} 
  5.     elseif($editor==2){$a="../../";} 
  6.     elseif($editor==3){$a="../../../";} 
  7.     else{$a="";} 
  8.      
  9.     if($ecms==1||$ecms==9) 
  10.     { 
  11.         $a=ECMS_PATH.'e/data/'
  12.     } 
  13.     if(strstr($gotourl,"(")||empty($gotourl)) 
  14.     { 
  15.         if(strstr($gotourl,"(-2")) 
  16.         { 
  17.             $gotourl_js="history.go(-2)"
  18.             $gotourl="javascript:history.go(-2)"
  19.         } 
  20.         else 
  21.         { 
  22.             $gotourl_js="history.go(-1)"
  23.             $gotourl="javascript:history.go(-1)"
  24.         } 
  25.     } 
  26.     else 
  27.     {$gotourl_js="self.location.href='$gotourl';";} 
  28.     if(empty($error)) 
  29.     {$error="DbError";} 
  30.     if($ecms==9)//前台弹出对话框 
  31.     { 
  32.         @include $a.LoadLang("pub/q_message.php"); 
  33.         $error=empty($novar)?$qmessage_r[$error]:$error; 
  34.         echo"<script>alert('".$error."');".$gotourl_js."</script>"
  35.         db_close(); 
  36.         $empire=null
  37.         exit(); 
  38.     } 
  39.     elseif($ecms==8)//后台弹出对话框 
  40.     { 
  41.         @include $a.LoadLang("pub/message.php"); 
  42.         $error=empty($novar)?$message_r[$error]:$error; 
  43.         echo"<script>alert('".$error."');".$gotourl_js."</script>"
  44.         db_close(); 
  45.         $empire=null
  46.         exit(); 
  47.     } 
  48.     elseif($ecms==7)//前台弹出对话框并关闭窗口 
  49.     { 
  50.         @include $a.LoadLang("pub/q_message.php"); 
  51.         $error=empty($novar)?$qmessage_r[$error]:$error; 
  52.         echo"<script>alert('".$error."');window.close();</script>"
  53.         db_close(); 
  54.         $empire=null
  55.         exit(); 
  56.     } 
  57.     elseif($ecms==6)//后台弹出对话框并关闭窗口 
  58.     { 
  59.         @include $a.LoadLang("pub/message.php"); 
  60.         $error=empty($novar)?$message_r[$error]:$error; 
  61.         echo"<script>alert('".$error."');window.close();</script>"
  62.         db_close(); 
  63.         $empire=null
  64.         exit(); 
  65.     } 
  66.     elseif($ecms==0) 
  67.     { 
  68.         @include $a.LoadLang("pub/message.php"); 
  69.         $error=empty($novar)?$message_r[$error]:$error; 
  70.         @include($a."message.php"); 
  71.     } 
  72.     else 
  73.     { 
  74.         @include $a.LoadLang("pub/q_message.php"); 
  75.         $error=empty($novar)?$qmessage_r[$error]:$error; 
  76.         @include($a."../message/index.php"); 
  77.     } 
  78.     db_close(); 
  79.     $empire=null
  80.     exit(); 

使用说明
$error:提示信息内容,可以为语言包变量,也可以直接提示内容。
$gotourl:提示信息转向链接地址
$ecms:0为后台提示信息、1为前台提示信息、8为后台提示信息(alert方式)、9为前台提示信息(alert方式)
$noautourl:0为自动转向页面,1为不自动转向页面。此参数可省略,默认为0
$novar:0为提示信息内容采用语言包变量,1为提示信息内容为直接提示内容。此参数可以省略,默认为0

使用范例:
  1. printerror("ErrorUrl","history.go(-1)"); 
前台提示,提示信息内容为语言包DbError变量内容,跳转上一页

附加说明:
此函数需结合$editor变量来确定目录层次。默认$editor变量为0。
当程序文件在/e/path/目录,$editor不用设置,也就是用默认0。
当程序文件在/e/path/path2/目录,$editor=1。
当程序文件在/e/path/path2/path3/目录,$editor=2。
当程序文件在/e/path/path2/path3/path4/目录,$editor=3。

¥ 打赏
×
如果您觉得文章帮助了您就打赏一下吧
非常感谢你的打赏,我们将继续分享更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏

本文《帝国cms系统提示信息框printerror()函数介绍》发布于石头博客文章,作者:shitouadmin,如若转载,请注明出处:https://www.pweb123.com/cms/empire/1025.html,否则禁止转载,谢谢配合!

文章点评

我来说两句 已有0条评论
点击图片更换

添加微信好友

添加微信好友

微信小程序

百度小程序