wkhtmltopdf 中的会话问题 [英] Session issue in wkhtmltopdf

查看:53
本文介绍了wkhtmltopdf 中的会话问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 wkhtmltopdf 库将 HTML 转换为 pdf,这里会话的行为非常不同,如果我们在调用链接时设置会话,那么它工作正常,但我们之前设置的会话没有得到?

I am converting HTML to pdf through wkhtmltopdf library, here session is behaving very differently that if we set the session when our link is called then it works fine but our previously set session is not getting?

exec('C://"Program Files"//wkhtmltopdf.exe ' . 'http://localhost/test.php?a=351' . ' ' . $file_name . '');

问题:

打印页面时,test.php 中设置的会话在此页面中可用.但是如果我们在之前的某个页面中设置会话,即 test2.php 那么这个值在 test.php 中为 null

Session set in test.php is available in this page when printing the page. But if we set the session in some previous page i.e test2.php then that value is null here in test.php

有什么想法吗?

推荐答案

因为这是会话的工作方式,wkhtmltopdf.exe 会创建另一个会话,另一个与您的脚本的连接,并且您不会从另一个会话获取值是正常的.

Because it's how sessions works, wkhtmltopdf.exe creates another session, another connection to your script, and it's normal that you won't get values from another session.

您可以通过 GET 将变量作为获取参数传递,也可以将它们存储在某个永久位置,例如文件或数据库.

You can pass variables as get parameters via GET or, you can store them in some permanent location, like file or database.

这篇关于wkhtmltopdf 中的会话问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆