在PHP中获取数组内的数组值(即来自多维数组)

时间:2017-05-09 12:24:41

标签: php html

我想将数组中的数组中的值设置为html表中的特定列。 Follwing是我的数组结构:

    Array
(
    [page] => 1
    [results] => Array
        (
            [0] => Array
                (
                    [poster_path] => /kgLTB53HinftRRwhft7yrUOclDC.jpg
                    [adult] => 
                    [overview] => A small suburban town receives a visit from a castaway unfinished science experiment named Edward.
                    [release_date] => 1990-12-05
                    [genre_ids] => Array
                        (
                            [0] => 14
                            [1] => 18
                            [2] => 10749
                        )

                    [id] => 162
                    [original_title] => Edward Scissorhands
                    [original_language] => en
                    [title] => Edward Scissorhands
                    [backdrop_path] => /8XVovs4mLYZmmr2pgU5KYXkohcP.jpg
                    [popularity] => 4.555998
                    [vote_count] => 2549
                    [video] => 
                    [vote_average] => 7.5
                )
.
.
.

[19] => Array
                (
                    [poster_path] => /cok0SSxmD7fYeZj6l9XOr2mb0YL.jpg
                    [adult] => 
                    [overview] => A quartet of mutated humanoid turtles clash with an uprising criminal gang of ninjas
                    [release_date] => 1990-03-30
                    [genre_ids] => Array
                        (
                            [0] => 878
                            [1] => 28
                            [2] => 12
                            [3] => 35
                            [4] => 10751
                        )

                    [id] => 1498
                    [original_title] => Teenage Mutant Ninja Turtles
                    [original_language] => en
                    [title] => Teenage Mutant Ninja Turtles
                    [backdrop_path] => /v4jw4Vu87A3bDq0UoZPShteABIY.jpg
                    [popularity] => 2.46742
                    [vote_count] => 384
                    [video] => 
                    [vote_average] => 6.5
                )

        )

    [total_results] => 2699
    [total_pages] => 135
)

我想将上面的数组元素分别设置为具有特定表属性的表

以下是具有列名的表结构。

<table  cellspacing="0" width="100%">
      <thead>
        <tr>
          <td><b>Sr. No</b>.</td>
          <td><b>poster_path</b></td>
          <td><b>adult</b></td>
          <td><b>overview</b></td>
          <td><b>release_date</b></td>
          <td><b>genre_ids</b></td>
          <td><b>id</b></td>
          <td><b>original_title</b></td>
          <td><b>original_language</b></td>
          <td><b>title</b></td>
          <td><b>backdrop_path</b></td>
          <td><b>popularity</b></td>
          <td><b>vote_count</b></td>
          <td><b>video</b></td>
          <td><b>vote_average</b></td>
        </tr>
      </thead>
</table>

0 个答案:

没有答案