下午好,我制作了这个剧本,但是我无法找到错误的地方,因为我试图编程时没有保存PDF。 如果有任何建议,谢谢。 我知道问题在于逻辑内部:函数file_newname但我不知道究竟在哪里。 提前谢谢。
// "$(function(){" is a jquery short cut for the jquery function:
// "$(document).ready(function(){ ... code goes here ... });"
// this function executes when the DOM is fully loaded.
// trying to set Event Listners like click handlers before the DOM has fully loaded
// usually doesn't work.
$(function(){
// this add the "function" as a click event handler on the input with type="submit"
$('input:submit').click(function(){
// this sets the value of all inputs with the name="group50"
// to the value of the input with the name="setgroup50"
$('input[name="group50"]').val($('input[name="setgroup50"]').val());
});
});
答案 0 :(得分:0)
尝试输出后,您正在显示新文件名。使用此:
$filename = $pdf->file_newname(date("Ymd").".pdf");
$pdf->Output($filename, 'F');
不要忘记输出命令中F标志的确切含义,但这就是我在脚本中的用法。
答案 1 :(得分:0)
这是正确的解决方案:
function file_newname($filename){
if($pos = strrpos($filename, '.')) {
$name = substr($filename, 0, $pos);
$ext = substr($filename, $pos);
}else{
$name = $filename;
}
$newpath = 'documenti/'.$filename;
$counter = 0;
while (file_exists("documenti/".$filename)) {
$filename = $name .'_'. $counter . $ext;
$newpath = "documenti/".$newname;
$counter++;
}
$this->Output("documenti/".$filename);
$this->Output();
}
$pdf->file_newname(date("Ymd").".pdf");<<<<