-1

「account.php」と呼ばれる私のphpファイルには、

<?php 
// First we execute our common code to connection to the database and start the session 
require("common.php"); 
// At the top of the page we check to see whether the user is logged in or not 
if(empty($_SESSION['user'])) 
{ 
    // If they are not, we redirect them to the login page. 
    header("Location: login.php"); 
    // Remember that this die statement is absolutely critical.  Without it, 
    // people can view your members-only content without logging in. 
    die("Redirecting to login.php"); 
}          
?> 
<html>
<body>
    <link rel="icon" type="image/gif" href="favicon.gif" />
    <?php include("header.php"); ?>
    <div id="main-box">
        <ul>
            <li class="buttons">
<?php 
//TEXT BOX WITH A LINE FROM **TEXT.txt** SHOULD APPEAR HERE AFTER USER CLICKS BUTTONS 
?>
                <input type="button" name="account" value="Get Your Account" onclick="#" />
            </li>
        </ul>
    </div>
</body>
</html>

ユーザーがボタンをクリックすると、テキスト ボックスが表示され、テキスト ファイルから 1 行が表示され、それを表示するとテキスト ファイルから削除されるようにしたいのです。 text.txt

Eddie so after the user clicks the button it displays this line to them and then deletes it after so that the next line would then become the first line. 
Apples
Hello
People

私の質問が理解できない場合は、お知らせください。さらに説明します。ありがとうございました。:)

4

1 に答える 1

0

私のお勧めは、javascript (または jQuery) を使用して、テキスト ファイルの読み取りを処理する PHP スクリプトへの AJAX 呼び出しを行い、それから一番上の行を削除することです。JavaScript は、スクリプトの応答 (テキスト ファイルの行) を取得し、ページにテキスト ボックスを追加する必要があります。

于 2013-01-09T06:21:10.810 に答える