I was creating router for my PHP website and came across such a method :
public function getURI() {
if (!empty($_SERVER["REQUEST_URI"])) {
// do some stuff and return the result
}
}
I figured out even if I request 'example.com'
- $_SERVER["REQUEST_URI"]
is not empty (it's '/'
)
The questions are:
Why do I need to check whether the $_SERVER["REQUEST_URI"]
is empty?
When REQUEST_URI
can be empty?