在PHP中创建`no-variable` if子句

Léo*_* 준영 1 php url if-statement

你如何制作if -clause哪个do this and thisif

  1. PHP中的URL没有变量?
  2. 没有变量哪个在PHP中有价值?

对于#1的if -clause应该为true的URL示例:

www.example.com/index.php
example.com/index.php
example.com/index.php?
Run Code Online (Sandbox Code Playgroud)

对于#2的if -clause应该为true的URL的示例:

example.com/index.php?successful_registration
example.com/index.php?successful_login
Run Code Online (Sandbox Code Playgroud)

以下是我失败的if -clause $ 1

if (isset($_REQUEST[''])) {
      // do this
}
Run Code Online (Sandbox Code Playgroud)

Pet*_*ley 7

if ( 0 == count( $_GET ) )
{
  // do this
}
Run Code Online (Sandbox Code Playgroud)

要么

if ( empty( array_keys( $_GET ) ) )
{
  // do this
}
Run Code Online (Sandbox Code Playgroud)

要么

if ( '' == $_SERVER['QUERY_STRING'] )
{
  // do this
}
Run Code Online (Sandbox Code Playgroud)