Hello StackOverflow社区,你好
我希望能够回应一个文件以upload/FirstName_LastName_FileName.ext
格式上传。在我的PHP文件中,我在这里有这个HTML:
<td>File Stored in:</td>
<td>upload/$uploadName_$filename</td>
但似乎此代码返回upload/$filename
。我该如何解决这种情况?我对此非常陌生,所以非常感谢帮助!
$uploadPath
找到了一种方法。该线现在看起来像这样:
$uploadPath = "upload/" . $uploadName . "_" . $filename;
// mail to, subject, message and its table...
<td>File Stored in:</td>
<td>$uploadPath</td>
即便如此,谢谢大家的快速解答!我给了最快的勾选标记。
答案 0 :(得分:1)
有很多方法可以做到这一点。这里有几个:
<td>upload/<?= $uploadName,'_',$filename; ?></td>
<td>upload/<?= $uploadName.'_'.$filename; ?></td>
<td>upload/<?php printf("%s_%s", $uploadName, $filename; ?></td>
<td>upload/<?= $uploadName; ?>_<?= $filename; ?></td>
<td>upload/<?= "{$uploadName}_{$filename}"; ?></td>
答案 1 :(得分:0)
使用php标签:
<td>File Stored in:</td>
<td>upload/<?php echo $uploadName?>_<?php echo $filename?></td>
答案 2 :(得分:0)
试试这段代码:
<td><?php echo 'upload/' . $uploadName . '_' . $filename; ?>**strong text**</td>