1

私はこのフォーラムでこれに関するいくつかのことを読みました.これは私のPHPコードです:

<?
$percorso = file("emma.txt");
while(list(,$value) = each($percorso)){
list($aboutme, $aboutme2) = split("[:]", $value);
#declaration trim()
$params["aboutme"] = trim($aboutme);
$params["aboutme2"] = trim($aboutme2);
#print results
//put aboutme in label
//put aboutme2 in label2
}
?>

基本的に: テキスト ファイル ( emma.txt) があり、その中にいくつかの情報が改行で区切られています。ここでは、eaxpmle を確認できます。

データ_1

データ_2

データ_3...

そのコードを使用して、各行の内容を読み取り、その内容をラベルに入れたいのですが、その方法がわかりません。これはラベルです: <label name="lbl1">Nickname</label>

$_GET[]ラベルのテキストをそれらのテキストファイルの行に設定したいので、この方法を使用することを考えていました。私に何ができる??

4

1 に答える 1

1

古き良きPHP:

次のように while ループ内でラベルを出力する必要があります。

<?
$percorso = file("emma.txt");
while(list(,$value) = each($percorso)){
list($aboutme, $aboutme2) = split("[:]", $value);
#declaration trim()
$params["aboutme"] = trim($aboutme);
$params["aboutme2"] = trim($aboutme2);
#print results
//put aboutme in label
//put aboutme2 in label2

// Method 1: Output each line via PHP echo:
echo "<label name='lbl1'>".$params['aboutme']."</label>";
// etc...

// Method 2: Output via break PHP for HTML:
?>

<label name='lbl2'><?php echo $params['aboutme2']; ?></label>
etc...

<?php
// If using Method 2, don't forget to resume PHP here!
}
?>
于 2013-07-02T23:20:25.037 に答える