我试图使用DomPDF获取PDF,但我遇到了一个奇怪的问题.所有数据和其他东西都很好但是当它以PDF格式呈现时,表格的第一行总是不合时宜.首先,我可能是表格正在下一页导致风格脱离上下文但我试图将表限制为一页,并发现问题仍然存在.所以,每一页上的第一行表都很疯狂.以下是我的PDF代码和屏幕截图.
调节器
$dompdf = new DOMPDF();
$dompdf->load_html($listing);
$dompdf->set_paper('a4', 'landscape');
$dompdf->render();
$dompdf->stream("sample.pdf");
Run Code Online (Sandbox Code Playgroud)
视图
<table class="table table-bordered">
<tr>
<th width="150">Client </th>
<td>Client Name </td>
</tr>
<tr>
<th>Site </th>
<td><?php print $site->title; ?></td>
</tr>
<tr>
<th>Address </th>
<td>
<?php
print $site->unit.' '.
$site->street.' '.
$site->suburb.' '.
$site->state.' '.
$site->location;
?>
</td>
</tr>
<tr>
<th>Post Code </th>
<td><?php print $site->postcode; ?></td>
</tr>
<tr>
<th colspan="2"> Site Information</th>
</tr>
<tr>
<td colspan="2" height="150"> <?php print $site->site_information; ?></td>
</tr>
<tr>
<th colspan="2">Work Instruction</th>
</tr>
<tr>
<td …Run Code Online (Sandbox Code Playgroud) 我正在使用codeigniter并且在查询时遇到问题.
$query = $this->db->query('SELECT datetime ...');
$resultdata['results'] = $query->result_array();
foreach($results as $result)
{
echo "<tr>";
echo "<td>".$result['datetime']."</td>";
echo "</tr>";
}
Run Code Online (Sandbox Code Playgroud)
此代码以此格式显示日期结果:2015-04-11 02:45:19.如何只用HOURS和MINUTES来做结果?谢谢.
我正在尝试上传图像,如图所示w3schools但它总是显示错误
Undefined index: file
Run Code Online (Sandbox Code Playgroud)
这是代码
HTML
<form action="upload.php" method="post" enctype="multipart/form-data">
<!-- Upload image -->
<input type="file" name="file" id="file">
<input type="submit" value="Upload Image" name="submit">
</form>
Run Code Online (Sandbox Code Playgroud)
PHP
<?php
if(!isset($_POST["submit"])){
die('Error');
}
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["file"]["tmp_name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0; …Run Code Online (Sandbox Code Playgroud)