gpt4 book ai didi

php - 如何捕获PHP中的错误

转载 作者:行者123 更新时间:2023-12-03 08:56:23 25 4
gpt4 key购买 nike

我在htaccess中使用以下内容:

ErrorDocument 400 /core/php/error.php
ErrorDocument 401 /core/php/error.php
ErrorDocument 403 /core/php/error.php
ErrorDocument 404 /core/php/error.php
ErrorDocument 500 /core/php/error.php
ErrorDocument 502 /core/php/error.php
ErrorDocument 504 /core/php/error.php

error.php看起来像这样:
switch($_SERVER["REDIRECT_STATUS"]){
case 400:
xxxxxxxxx relevant code here
break;
case 403:
xxxxx code here
break;
...

我想确切地知道产生404错误的资源是什么(将它们放入这样的数组中:
$array[err01][image.jpg]
[err02][file.html]

并且还想知道导致403错误的确切网址,如下所示:
$array[referer][here goes the referer, if it exists]
[403 error route][user tried to access: public/admin/core/php]

能做到吗如果是这样,怎么?
在这上浪费了一整天,还是一无所有! (什么菜鸟!)

最佳答案

REQUEST_URI是执行此操作的$ _SERVER值

关于php - 如何捕获PHP中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23817733/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com