今天我需要这份表格的帮助。它将以.vcf格式保存vcard中的数据,此表单位于html页面中,我无法提交到其他页面。所以现在,如果我点击保存按钮,它会在.vcf扩展名中正确下载,但在文件中有整个html页面......我只需要下载vcard,并且我正在使用从这里重新启动的类{{3} }。 也许用simple_html_dom.php我可以提取我需要的div ... 谢谢你的帮助!
<form method="post" action="#">
<button name="btn_func" class="btn waves-effect waves-light red">
<span class="white-text">Salva nella rubrica</i></span>
</button>
<div id="savecard">
<?php
include('simple_html_dom.php');
include('vcard.php');
$card = new vCard();
$card->setnew("first_name", $params['user']->first_name);
$card->setnew("last_name", $params['user']->last_name);
$card->setnew("birthdate", $params['user']->birthdate);
$card->setnew("home_address", $params['user']->address);
if(isset($_POST['btn_func'])){
$card->download();
}
?>
</div></form>
答案 0 :(得分:0)
只需在PHP代码中添加标题即可。
<form method="post" action="#">
<button name="btn_func" class="btn waves-effect waves-light red">
<span class="white-text">Salva nella rubrica</i></span>
</button>
<div id="savecard">
<?php
include('simple_html_dom.php');
include('vcard.php');
$card = new vCard();
$card->setnew("first_name", $params['user']->first_name);
$card->setnew("last_name", $params['user']->last_name);
$card->setnew("birthdate", $params['user']->birthdate);
$card->setnew("home_address", $params['user']->address);
if(isset($_POST['btn_func'])){
header('Content-Type: text/x-vcard');
$card->download();
}
?>
</div></form>
希望这可以帮助你..