S
S
Schoolboy.2015-10-05 16:17:27
PHP
Schoolboy., 2015-10-05 16:17:27

How to make php script execution not get stuck on an error?

The script executes file_get_contents(), and the server to which it accesses is not available. Therefore, an error appears and the script does nothing further.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitaly Inchin ☢, 2015-10-05
@viphorizon

@file_get_contents();

S
Stalker_RED, 2015-10-05
@Stalker_RED

php.net/manual/en/function.file-get-contents.php
The function returns the read data or FALSE on failure.
add a check

$data = file_get_contents($filename);
if ($data) {
    // что-то делаем
} else {
    die('Нет доступа к файлу '.$filename);
}

P
PO6OT, 2015-10-05
@woonem

If a fatal error, only this will help:
habr.ru/73589

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question