0

Is there a php way on how to check if the url is use now?

for example I have

http://site.com/login.php?action=submit

using isset($_GET[action])

we can check that action exists in the url

but how can I check if

login.php

is the one that is active url?

2 Answers 2

2

Something like this:

if ( '/login.php' == $_SERVER['REQUEST_URI'] ) {
    // This is login.php
} else {
    // This is not login.php
}
Sign up to request clarification or add additional context in comments.

Comments

0

You can test $_SERVER['REQUEST_URI'] to see if it contains login.php. It contains the current URI. See the PHP manual for $_SERVER here: http://php.net/manual/en/reserved.variables.server.php

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.