링크 1 링크 2 앞에 글자넣을수 있을까요?
본문
안녕하세요... 아무리 연구해봐도... 안되서 이렇게 글 남깁니다.
1번 링크는 공식 사이트구요...
2번 링크는 자막파일 링크주소입니다.
1번 링크 앞에 공식
2번 링크앞에 자막
이렇게 글자넣는 방법이 있을까요??
<th scope="row">1.공식 / 2.자막링크</th>
<td> <!-- 관련링크 시작 { -->
<!-- <section id="bo_v_link">
<h2>관련링크</h2>
<ul> -->
<?php
// 링크
$cnt = 0;
for ($i=1; $i<=count($view['link']); $i++) {
if ($view['link'][$i]) {
$cnt++;
$link = cut_str($view['link'][$i], 40);
?>
<li>
<i class="fa fa-link" aria-hidden="true"></i> <a href="<?php echo $view['link_href'][$i] ?>" target="_blank">
<strong><?php echo $link ?></strong>
</a>
<span class="bo_v_link_cnt"><?php echo $view['link_hit'][$i] ?>회 연결</span>
</li>
<?php
}
}
?>
</ul>
</section>
<!-- } 관련링크 끝 --></td>
</tr>
답변 1
* PHP v7.0 이상
<th scope="row">1.공식 / 2.자막링크</th>
<td> <!-- 관련링크 시작 { -->
<!-- <section id="bo_v_link">
<h2>관련링크</h2>
<ul> -->
<?php
$link_head = [1=>'1.공식 ', '2.자막 '];
// 링크
$cnt = 0;
for ($i=1; $i<=count($view['link']); $i++) {
if ($view['link'][$i]) {
$cnt++;
$link = cut_str($view['link'][$i], 40);
?>
<li>
<i class="fa fa-link" aria-hidden="true"></i> <a href="<?php echo $view['link_href'][$i] ?>" target="_blank">
<strong><?php echo ($link_head[$i]??'').$link ?></strong>
</a>
<span class="bo_v_link_cnt"><?php echo $view['link_hit'][$i] ?>회 연결</span>
</li>
<?php
}
}
?>
</ul>
</section>
<!-- } 관련링크 끝 --></td>
</tr>
버전 상관없이….
<th scope="row">1.공식 / 2.자막링크</th>
<td> <!-- 관련링크 시작 { -->
<!-- <section id="bo_v_link">
<h2>관련링크</h2>
<ul> -->
<?php
$link_head = array(1=>'1.공식 ', '2.자막 ');
// 링크
$cnt = 0;
for ($i=1; $i<=count($view['link']); $i++) {
if ($view['link'][$i]) {
$cnt++;
$link = cut_str($view['link'][$i], 40);
?>
<li>
<i class="fa fa-link" aria-hidden="true"></i> <a href="<?php echo $view['link_href'][$i] ?>" target="_blank">
<strong><?php echo (isset($link_head[$i])?$link_head[$i].'').$link ?></strong>
</a>
<span class="bo_v_link_cnt"><?php echo $view['link_hit'][$i] ?>회 연결</span>
</li>
<?php
}
}
?>
</ul>
</section>
<!-- } 관련링크 끝 --></td>
</tr>