Novice laravel,session keeps reporting errors.
is configured as follows:
config/session.php
return [
"driver" => env("SESSION_DRIVER", "file"),
"lifetime" => 120,
"expire_on_close" => false,
"encrypt" => false,
"files" => storage_path("framework/sessions"),
"connection" => "session",
"lottery" => [2, 100],
"cookie" => "laravel_session",
"path" => "/",
"domain" => null,
"secure" => false,
];
controller is as follows:
use Illuminate\Http\Request;
class AccountController extends Controller
{
/**
*
*/
public function login(Request $request)
{
$phone = Input::get("mobile");
$pwd = Input::get("pwd");
$callback = Input::get("callback","");
if (empty($phone) || empty($pwd)) {
exit(json_encode(["code"=>-1,"msg"=>"params not null"]));
}
$userService = UserService::getInstance();
$resInfo = $userService->login($phone,$pwd);
$a = $request->session()->put("user",1111);
$b = $request->session()->save();
var_dump($a, $b);die;
if ($resInfo) {
$ret = ["code"=>0,"msg"=>"ok","data"=>$resInfo];
}else{
$ret = ["code"=>-1,"msg"=>"error"];
}
if($callback)
exit($callback . "(".json_encode($ret).")");
exit(json_encode($ret));
}
the output is always Session store not set on request,. Could you tell me how to configure and operate the session of laravel5.6?