简单的PHP单词列表到HTML有序列表

时间:2019-06-09 15:14:50

标签: php

所以我的话在下面,用空格隔开。我的代码是从文本文件中抓取第一行,并且回显了整行,而我需要将每个单词作为有序列表。

  

•孟买new_delhi chennai culcutta

public class Movie {
private String title;
private String description;
private int thumbnail;
private String studio;
private String Rating;
private String streaminglink;

public Movie(String title , int thumbnail) {
    this.title = title;
    this.thumbnail = thumbnail;

}

public Movie(String title, int thumbnail) {
    this.title = title;
    this.thumbnail = thumbnail;
}

public String getTitle() {
    return title;
}



public int getThumbnail() {
    return thumbnail;
}

我需要这样

  

•孟买

     

•new_delhi

     

•钦奈

     

•culcutta

3 个答案:

答案 0 :(得分:1)

foreach()

之前
echo '<ol>';
//foreach loop
echo '</ol>';

答案 1 :(得分:0)

<?php
$z = file('q1.txt'); echo $z[1]; echo (mt_rand(1,9)); 

$c=  explode(" ", $z[1]);
echo '<ol>';
foreach($c as $w) {echo " <li>$w</li>\n";}
echo '</ol>';

答案 2 :(得分:0)

<table>
    <tr>
        <a href="link-to-website">
            <img src="link-to-image" width="165" height="38" />
        </a>
     </tr>
 </table>