J
J
John Didact2020-05-14 18:24:39
PHP
John Didact, 2020-05-14 18:24:39

Why doesn't session_start() take parameters?

PHP 5.6. openserver.
The function, as I understand it, ignores the parameters passed to it - an associative array with options.

session_start([
 'save_path' => JDSys::ware('tmp_sess', true),    // JDSys::ware() возвращает полный путь к директории с временными файлами сессии,
 'name' => 'CONST',                               // ключ к имени временной сессии в куках,
 'read_and_close' => true,                        // прочитать и не блокировать файл сессии.
]);
this code, for some reason, does not work: the session file is stored in the server's temporary directory, the key in the cookie is PHPSESSID, and the session file is blocked and overwritten.
If I do this:
session_save_path(JDSys::ware('tmp_sess', true)); // работаю с сессией в папке с временными сессиями,
session_name('CONST');                            // индекс сессии в куки - CONST,
session_start();
session_write_close();                            // записываю данные сессии в файл и снимаю с блокировки.
then everything goes as planned.

I would not want to write so much extra code (no need to hate me for this) and for a moment, but lock the session file.

What's wrong? Maybe I missed something???

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman PHP, 2020-05-14
@JohnDidact

look in the dock, from which version the function began to accept the options parameter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question