echoing variable in header function FPDF

浪尽此生 提交于 2019-12-08 05:20:37

问题


i will echoing variable in header function. i have variable code like this :

$bulan=array("","Jan","Feb", "Mar", "Apr", "Mei", "Jun", "jul", "Agust", "Sept", "Okt", "Nop", "Des");
$tgl1=$_GET['tgl1']; //2017-08-10
$tgl2=$_GET['tgl2']; //2017-08-15
$tg1=substr($tgl1,8); //10
$tg2=substr($tgl2,8); //15
$bln1=$bulan[substr($tgl1,5,2)*1]; //Agust
$bln2=$bulan[substr($tgl2,5,2)*1]; //Agust
$thn=substr($tgl2,0,4); //2017

in my header function have code to echoing variable like this:

$this->Cell(20, 0.5, 'Tanggal '.$tg1.' '.$bln1.' - '.$tg2.' '.$bln2.' '.$thn, 0, '0', "C", false);

i want to display like this : Tanggal 10 Agust - 15 Agust 2017

But its just display this : Tanggal -

How to display variable in my header ?


回答1:


i think i have a solution. but its not the best solution. i cant echoing a variable in function, so im echoing contents of the variable. like this :

$this->Cell(20, 0.5, 'Tanggal '.substr($_GET['tgl1'],8).'etc...', 0, '0', "C", false);

Please comment if there is a better way



来源:https://stackoverflow.com/questions/45856504/echoing-variable-in-header-function-fpdf

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