How to pass laravel session to wkhtmlltopdf

二次信任 提交于 2019-12-24 20:24:20

问题


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.

  1. They're not PHP's sessions, so none of the PHP session functions apply.
  2. 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.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!