【发布时间】:2014-12-18 08:03:13
【问题描述】:
我有一个表单,它必须用 JSON 数据中的数据填充,并且应该使用 mpdf 将表单创建为 pdf 并发送到 mail。因为我使用的是 jquery 和 ajax。
首先我使用了将 json 数据发送到 PHP 文件的 ajax。在 PHP 文件中,我使用以下
`$json = file_get_contents('php://input');//to getting json post values we need to use
$obj = json_decode($json,true);
$obj1=http_build_query($obj);
//print_r($obj);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $obj1
)
);
$context = stream_context_create($opts);
$result = file_get_contents('PDF_Form.php', false, $context);
echo $result;`
现在显示的是结果而不是值。请告诉我问题出在哪里。
我需要将所有的帖子值放在表单中,然后表单应该作为字符串转换为 ajax 响应以创建 pdf 并发送邮件。
问候, 雷卡
【问题讨论】:
标签: jquery ajax pdf file-get-contents