Get each line from textarea

前端 未结 8 1786
盖世英雄少女心
盖世英雄少女心 2020-12-04 10:42


$         


        
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-04 11:43

    It works for me:

    if (isset($_POST['MyTextAreaName'])){
        $array=explode( "\r\n", $_POST['MyTextAreaName'] );
    

    now, my $array will have all the lines I need

        for ($i = 0; $i <= count($array); $i++) 
        {
            echo (trim($array[$i]) . "
    "); }

    (make sure to close the if block with another curly brace)

    }
    

提交回复
热议问题