一维数组 的有关问题。请问

WBOY
Release: 2016-06-13 13:41:31
Original
895 people have browsed it

一维数组 的问题。请教
Array
(
  [0] => 55
  [1] => sssssssssssss
  [2] => 66
  [3] => 你上看见fks剪短发
  [4] => 77
  [5] => 今天吃你什么了饭了
)

请问怎么可以这么实现 奇数做链接 偶数是标题

sssssssssssss

你上看见fks剪短发

今天吃你什么了饭了

------解决方案--------------------

PHP code

for($i=0,$n=sizeof($arr);$i{$arr[$i+1]}";
}
<br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
PHP code
$ar = Array(
  '55',
  'sssssssssssss',
  '66',
  '你上看见fks剪短发',
  '77',
  '今天吃你什么了饭了',
);

foreach(array_chunk($ar, 2) as $v)
  echo "<a href="%24v%5B0%5D.html">$v[1]</a>";
<br><font color="#e78608">------解决方案--------------------</font><br>也来一个。<br>
Copy after login
PHP code

do{
      $link=array_shift($arr);
      $t=array_shift($arr);
      echo '<a href="'.%24link.'.html">'.$t.'</a>';
}while($arr); <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template