Sometimes you want to react differently, when the current script is running in a command-line environment. Drupal does this internally e.g. for session handling.

In Drupal 7, there was a dedicated drupal_is_cli() function.

In Drupal 8, this function was removed because you can instead directly check the PHP_SAPI constant:


if (PHP_SAPI === 'cli') {
  // Do stuff
}

 

Comments

Klartext

  • Keine HTML-Tags erlaubt.
  • Zeilenumbrüche und Absätze werden automatisch erzeugt.
  • Website- und E-Mail-Adressen werden automatisch in Links umgewandelt.
The content of this field is kept private and will not be shown publicly.