问题
I'm trying to print pages, using wkhtmltopdf, that are protected by auth filter in Laravel.
I'm using the standard session cookie -- in config/session.php:
'driver' => 'cookie',
'cookie' => 'laravel_session',
But passing the session cookie does nothing, i.e:
$ wkhtmltopdf --cookie laravel_session [cookie value] http://myurl.com/protected test1.pdf
just prints the login page. Anyone know if there is some special stuff that needs to be done when passing auth cookies to laravel, or what else i am doing wrong? Thanks
回答1:
There are a few things to be aware of when using Laravel's sessions.
- They're not PHP's sessions, so none of the PHP session functions apply.
- The "cookie" in the session config holds the session identifier used by any of the drivers to identify the session; it does not relate to the cookie driver.
- The cookie session driver stores the session's data in a second cookie named "session_payload" 1, and is limited to 4KB 2
I would recommend that you switch to any other session driver and try again with the same method you've tried above. The file session driver requires little setup (just file permissions), or the database session driver requires a table creating in your database.
来源:https://stackoverflow.com/questions/15903355/how-to-pass-laravel-session-to-wkhtmlltopdf