我有这个问题:
我在模板中创建了一个链接:
<div class="four columns alpha colform gestmtop">
<h4 class="labelform">STAMPA REPORT</h4>
<select name="" id="stampa-select">
<option value='etichette'>Etichette</option>
<option value='lista1'>Lista 1</option>
<option value='lista2'>Lista 2</option>
</select>
</div>
<div class="four columns"><a href="#" onclick='openStampaPfd();' class="gestg">STAMPA</a></div>
<div id="foo"></div>
function openStampaPfd(){
var valSelected = $("#stampa-select").val();
// alert(valSelected);
var table = $('#anagrafica_datatable').DataTable();
var ids=[];
table.column(0, { search:'applied' } ).data().each(function(value, index) {
ids.push(value);
});
if (valSelected==='lista1'){
$("#foo").append("<a href='"+Routing.generate('anagrafica_lista_pdf',{ids: ids})+"'>Report Lista</a>");
}else if (valSelected==='lista2'){
$("#foo").append("<a href='"+Routing.generate('anagrafica_lista2_pdf',{ids: ids})+"'>Report Lista2</a>");
}else if (valSelected==='etichette'){
$("#foo").append("<a href='"+Routing.generate('anagrafica_etichette_pdf',{ids: ids})+"'>Report Etichette</a>");
//window.open ('/example/stampa_etichette_clienti.php','_blank',false)
}
///example/stampa_etichette_clienti.php
};
在我的控制器中,相关操作是:
/**
* Print Anagrafica PDF.
*
* @Route("/anagraficaEtichettePdf/{ids}", name="anagrafica_etichette_pdf", options={"expose"=true})
* @Method("POST")
*/
public function anagraficaEtichettePdfAction($ids){
$em = $this->getDoctrine()->getManager();
$query = $em->createQuery('SELECT a
FROM KritekGestionaleBundle:Anagrafica a WHERE a.id IN ('.$ids.')');
$html = $this->renderView('KritekGestionaleBundle:Anagrafica:anagraficaEtichettePdf.html.twig', array('anagraficheList'=>$query->getResult()));
return new Response(
$this->get('knp_snappy.pdf')->getOutputFromHtml($html),
200,
array(
'Content-Type' => 'application/pdf',
'charset' => 'UTF-8',
)
);
}
问题是:
Forbidden
You don't have permission to access /app_dev.php/anagrafica/anagraficaEtichettePdf/00006,00007,00008,00009,00010,00011,00012,00013,00014,00015,00016,00017,00018,00019,00020,00021,00022,00023,00024,00025,00026,00027,00028,00029,00030,00031,.........(over 4000)
我怎样才能解决网址过长的问题? 还有另一种方法可以解决这个问题吗? 谢谢!