Thinkphp5.1 encountered session problems when learning
清风新影
清风新影 2019-12-30 09:50:56
0
5
1449

Does anyone know that after I added session:set() to the controller, the method failed and no error was reported? Please help me find out why. I used phpstudy to deploy the apache server!

The code is as follows:

<?phpnamespace app\index\controller;
use app\index\controller\Base;use think\Request;

use app\index\model\User as UserModel;

use think\Session;
class User extends Base{
// Login page

function login() %

清风新影
清风新影

reply all(4)
lk

Hahaha, static references need to use think/faced/session

有什么是忘不了的。

I think it's your session::set('user_info', $user->getdata()); that is wrong. The getdata in $user->getdata() should be getData

image.png

刀刀

Have you solved it?

I have the same problem

ringa_lee

Is session enabled in your configuration?

  • reply Open session.PHP in the config directory, session.auto_start=1 in php.ini
    清风新影 author 2020-01-01 18:07:01
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!