is-cli.php
This commit is contained in:
parent
6133849718
commit
ed3a5e044f
@ -11,4 +11,4 @@ cd build
|
||||
cmake ..
|
||||
make
|
||||
make install
|
||||
```
|
||||
```
|
||||
|
@ -94,4 +94,4 @@ Array
|
||||
[total] => 1.46 Тб
|
||||
[total_bytes] => 1600874422272
|
||||
)
|
||||
*/
|
||||
*/
|
||||
|
12
php/is-cli.php
Normal file
12
php/is-cli.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Определяет запущен ли скрипт через php-cli
|
||||
* Checks if script running under php-cli
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_cli(): bool
|
||||
{
|
||||
return PHP_SAPI === 'cli'
|
||||
|| (!isset($_SERVER['DOCUMENT_ROOT']) && !isset($_SERVER['REQUEST_URI']));
|
||||
}
|
Loading…
Reference in New Issue
Block a user