In laravel, subclass controllers can use session, but parent class controllers cannot.

WBOY
Release: 2016-10-10 11:55:58
Original
1101 people have browsed it

In laravel, subclass controllers can use session, but parent class controllers cannot. How to solve it?

Reply content:

In laravel, subclass controllers can use session, but parent class controllers cannot. How to solve it?

Considering that the situation you described is not too detailed

  • Check whether the Session has a path set. The path of config/session.php needs to be /, or other paths. It cannot be an empty string

  • Laravel does have a bug under Session. If Laravel uses file as the Session engine, when requestssome pages at the same time, the SessionID will indeed be reset (set-cookie:sessionid=xxxx) because it cannot be obtained. If the situation arises, it can be solved by changing the Session engine to database or redis (requires php artisan session:table and migrating the database)
    (.env's SESSION_DRIVE)

Please describe the problem in more detail. Laravel session has nothing to do with the controller.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!