Writing a string array to text file separated by new line character

后端 未结 3 1301
挽巷
挽巷 2021-01-03 07:38

I have a PHP page which accepts input from user in a text area. Multiple strings are accepted as input from user & would contain \'\\n\' and I am scanning it as:

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-03 08:04

    Try this:

    $data = explode("\n", $_GET['TxtareaInput']);
    foreach($data as $value){
        fwrite($ourFileHandle, $value.PHP_EOL);
    }
    

提交回复
热议问题