从包含文件中解释错误消息... [英] interpreting error messages from include files...

查看:77
本文介绍了从包含文件中解释错误消息...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


i是PHP编程的新手,想知道你是否可以提供帮助。


假设我有以下文件:


1. error.php:路由到所有错误。这个页面应该

根据提供的

参数向用户显示正确和解释性的错误消息。

2. errordef.php:all all错误代码及其解释

" defined"作为常数。


现在,说我有3个不同的文件即。 a.php,b.php和c.php,以及

当这些文件中出现任何错误时,我想路由到

error.php以获取详细说明。每个a.php,b.php和c.php将错误代码传递给error.php,但是error.php应该解释来自定义文件errordef的代码来自
。 php!

我该怎么实现呢?任何快速帮助将不胜感激。

解决方案

r6****@gmail.com 写道:

你好,

我是PHP编程的新手,想知道你是否可以提供帮助。

让我说我有以下文件:

1. error.php:路由到所有错误。此页面应根据提供的
参数向用户显示正确且解释性的错误消息。
2. errordef.php:包含所有错误代码及其解释
定义"作为常数。

现在,说如果我有3个不同的文件即。 a.php,b.php和c.php,以及
当这些文件中出现任何错误时,我想路由到
error.php以获取详细说明。每个a.php,b.php和c.php将错误代码传递给error.php,但是error.php应该解释来自定义文件errordef.php的代码!
怎么能我执行这个?任何快速的帮助将不胜感激。




如果a.php中发生错误,那么


@header(" Location) :./ error.php?id = 1");

退出;


并且在error.php中......


id = array_key_exists(''id'',


_GET)?

strip_tags(stripslashes(trim(

hello,

i am new to PHP programming and wondered if u could help.

lets say i have the following files:

1. error.php: that is routed to for all errors. this page should
display proper and explanatory error messages to the user based on the
parameter provided.
2. errordef.php: has all the error codes and their explanations
"defined" as constants.

now, say if i have 3 different files viz. a.php, b.php and c.php, and
when any error occuring in either these files, i want to route to
error.php for detailed explanation. each a.php, b.php and c.php passes
error code to error.php, but error.php should interpret the code from
the definition file errordef.php!
how can i implement this? any quick help will be appreciated.

解决方案

r6****@gmail.com wrote:

hello,

i am new to PHP programming and wondered if u could help.

lets say i have the following files:

1. error.php: that is routed to for all errors. this page should
display proper and explanatory error messages to the user based on the
parameter provided.
2. errordef.php: has all the error codes and their explanations
"defined" as constants.

now, say if i have 3 different files viz. a.php, b.php and c.php, and
when any error occuring in either these files, i want to route to
error.php for detailed explanation. each a.php, b.php and c.php passes
error code to error.php, but error.php should interpret the code from
the definition file errordef.php!
how can i implement this? any quick help will be appreciated.



If the error occurs in a.php then

@header("Location: ./error.php?id=1");
exit;

And in error.php ...


id = array_key_exists(''id'',


_GET) ?
strip_tags(stripslashes(trim(


这篇关于从包含文件中解释错误消息...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆