14 lines
371 B
PHP
14 lines
371 B
PHP
<?php
|
|
/**
|
|
* Определяет запущен ли скрипт через php-cli
|
|
* Checks if script running under php-cli
|
|
*
|
|
* @return bool
|
|
* @see https://gist.github.com/anthonyaxenov/c1b237af14ec91aead19be66cdfc29e3
|
|
*/
|
|
function is_cli(): bool
|
|
{
|
|
return PHP_SAPI === 'cli'
|
|
|| (!isset($_SERVER['DOCUMENT_ROOT']) && !isset($_SERVER['REQUEST_URI']));
|
|
}
|