简体   繁体   中英

How to set PHP error messages to Session Variable?

How can store the php code error messages to session variable so that i can access to the error messages to another page:

Eg:

$_SESSION[error] = error_reporting(0);

Output:

Notice: Use of undefined constant data - assumed 'data' in F:\\Currnet Source\\Infogreen\\root\\Advocate\\lib\\script\\error_session.php on line 5

Notice: Undefined index: data in F:\\Currnet Source\\Infogreen\\root\\Advocate\\lib\\script\\error_session.php on line 5

Please Help me to resolve my problem.

您必须将错误变量名称括起来,并在其前加上任何引号将其表示为常量

$_SESSION['error'] = 'Your error code here';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM