2

In Chrome inspector when I hit a 404 I see:

Request URL:http://myapp.dev/doesnotexist
Request Method:GET
Status Code:404 Not Found
Remote Address:192.X.X.X:80

So far I've only been able to get the numeric code, "404" by using $exception->getStatusCode()

Is there a way to get the text description of "Not Found" in PHP (or Laravel)?

4
  • Are you using cURL? It looks like curl_error() returns this information. Commented Mar 8, 2016 at 23:38
  • I have cURL installed but he error is not from a cURL request so I don't think that would work. Commented Mar 8, 2016 at 23:43
  • If Laravel doesn't provide an API to this, you may need to use cURL instead. Commented Mar 8, 2016 at 23:46
  • @Barmar I think OP is serving a web service, not consuming one. Commented Feb 16, 2020 at 6:26

2 Answers 2

1

have you changed your app/config/app.php to:

'debug' => env('APP_DEBUG', true),
Sign up to request clarification or add additional context in comments.

1 Comment

I need this to work in production (with debug off) because I want to display the error text to the end user for troubleshooting purposes.
0

If You want to display Custome 404 Error page, you can create 404.blade.php file in views/errors directory.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.