Answer the question
In order to leave comments, you need to log in
Variable substitution in a cell?
I have php code
<?php
# Путь к файлу
$file_name = "set.txt";
# Считываем информацию по строкам
$data = file( $file_name );
$i = 1;
echo '<table border="1">';
echo ' <tr>
<th>№</th>
<th>Название</th>
<th>Уровень</th>
<th>Очки</th>
<th>Очки</th>
<th>Очки</th>
<th>Очки</th>
<th>Очки</th>
<th>Очки</th>
</tr>';
# В цикле обходим массив данных
foreach( $data as $value ):
# Разбиваем строку по |
$value = explode( "|", $value );
echo '<tr>';
{
echo '<td>' . $i++ . '</td>';
echo '<td>' . $value[0] . '</td>';
echo '<td>' . $value[1] . '</td>';
echo '<td>' . $value[2] . '</td>';
echo '<td>' . $value[3] . '</td>';
echo '<td>' . $value[4] . '</td>';
echo '<td>' . $value[5] . '</td>';
echo '<td>' . $value[6] . '</td>';
echo '<td>' . $value[7] . '</td>';
echo '</tr>';
}
endforeach;
echo '</table>';
?>
<?php $host="192.168.1..1"; exec("ping -c 1 " . $host, $output, $result); if ($result == 0) echo "<img src='/set/img/ok.png' width='40' height='40' >"; else echo "<img src='/set/img/no.png' width='40' height='40' ";?>
Answer the question
In order to leave comments, you need to log in
$custom_data = '';
$host="192.168.1..1";
exec("ping -c 1 " . $host, $output, $result);
if ($result == 0) $custom_data = "<img src='/set/img/ok.png' width='40' height='40' >"; else $custom_data = "<img src='/set/img/no.png' width='40' height='40' ";
foreach( $data as $value ):
# Разбиваем строку по |
$value = explode( "|", $value );
echo '<tr>';
{
echo '<td>' . $i++ . '</td>';
echo '<td>' . $value[0] . '</td>';
echo '<td>' . $value[1] . '</td>';
echo '<td>' . $value[2] . '</td>';
if($i == 4 /* 4 строка*/) $value[3] = $custom_data;
echo '<td>' . $value[3] . '</td>';
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question