PHP
- 2 ответа
- 0 вопросов
1
Вклад в тег
<?php
require_once 'PHPExcel-1.8/Classes/PHPExcel.php';
$excel = PHPExcel_IOFactory::load('catalog.xlsx');
$excel->setActiveSheetIndex(0);
echo "<table border='1'>";
$count = 0;
for ($i=2; $excel->getActiveSheet()->getCell('A'.$i)->getValue() != ""; $i++) $count = $i;
for ($a=0; $a < 10; $a++) {
$key = rand(2,$count);
$description = $excel->getActiveSheet()->getCell('A'.$key)->getValue();
$image = $excel->getActiveSheet()->getCell('B'.$key)->getValue();
$price_new = $excel->getActiveSheet()->getCell('C'.$key)->getValue();
$price_old = $excel->getActiveSheet()->getCell('D'.$key)->getValue();
$discount = $excel->getActiveSheet()->getCell('F'.$key)->getValue();
echo "
<tr>
<td>".$description."</td>
<td><img src='images/".$image."' width='150' height='150'></td>
<td>".$price_new."</td>
<td><s>".$price_old."</s></td>
<td>".$discount."%</td>
</tr>
";
}
echo "</table>";
?>
strtotime()затем сравнить два диапазона с помощью цикла