Просмотр поста

.
Rakovskiy
The Fast, Secure and Professional - Yii2

Вот, указываешь путь в $path и всё.

function nextKey(array $array, $cookieKey){
    $array = array_keys($array);

    $myKey = isset($_COOKIE[$cookieKey], $array[$_COOKIE[$cookieKey]]) ? $_COOKIE[$cookieKey] : $array[0];
    $nextKey = isset($array[$myKey]) && isset($array[$myKey + 1]) ? $array[$myKey + 1] : $array[0];

    setcookie($cookieKey, array_search($nextKey, $array), time() + 86400);

    return $nextKey;
}



$path = 'http://site.name/zapros/3zapros.php';

$file = unserialize(file_get_contents($path));
$key = nextKey($file, 'slider');
$url = isset($file[$key]) ? $file[$key] : null;
$label = str_replace('-', ' ', $url);

echo '<li><b><a href="/' . $url . '/">' . $label . '</a></b></li>';