Read in text file line by line php - newline not being detected -


I have a PHP function that I wrote that will take a text file, and each row in the table as its row Will list. / P>

The problem is that the classic "works fine on my machine", but of course when I ask someone else to generate a .txt file, then it's in the whole file as 1 line Continue reading. When I open it in my text editor, it seems like how I expect it to be with each new name on each line, but its new look or something to throw it out.

So far, I can conclude that something like that with the text editor on their Mac system is being used.

Does this mean? And is there an easy way to explore this lesson that the text editor is recognized as a new line and it can change with a standard that PHP recognizes

UPDATE: The following line Adding this issue can be resolved.

  ini_set ('auto_detect_line_endings' is true); Function:  
  function displayTXTList ($ fileName) {if (file_exists ($ fileName)) {$ file = fopen ($ fileName, 'r'); While (! FIFF ($ file)) {$ name = fgets ($ file); Echo ('& lt; tr & gt; & lt; td align = "center" & gt;' $ name. '& Lt; / td & gt; & lt; / tr & gt;';); } Fclose ($ file); } Else {echo ('& lt; tr & gt; & lt; td align = "center" & gt; Placeholder  & lt; / tr & gt;'); }}  

Does it not work for you?


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -