PHP Tutorial 24 - Reading A File (PHP For Beginners)

preview_player
Показать описание
There are multiple ways to read a file in PHP but the method recommended by PHP.NET is to use the file_get_contents function. It will return the file as a string and then allow you to play around with it. You could use this for a local text file on your machine or even an external HTML page.

For more information, check out the website:

Рекомендации по теме
Комментарии
Автор

Thank you, you helped me big time.
I have searching the whole day for function that could actually read the content from text file when user write the absoulute path to it.


Labyrinthman
Автор

thanx dude .. you are helping everyone much .. May ALLAH bless you and keep you safe always..

SuperDanishkhan
Автор

simple and to the point, keep it coming...good show

SatinderSatsangi
Автор

Thanks for the video. I am a real beginner and i'm watching from first tutorial. this helps me alot!!!

JOAN
Автор

Thank u for u r great work chris... Finally i have watched all the PHP video.... GOOD JOB

pradeepkumar
Автор

You can also use the <pre> tag in html...
Like this: 
<pre> echo $document; </pre>

rijulluman
Автор

Can't wait for your next videos Chris

TheFakeVIP
Автор

u r doing very good job... but right now i am busy in watching ur VB videos.. I will on PHP after completing them

HiteshBairathi
Автор

@IAFYM Yeah but I find it's good practice to code without auto complete, if you're ever editing code directly through a FTP client and you are completely used to auto complete then you'll make lots of mistakes. It would also make it more difficult to debug code through FTP too.

TeachMeComputer
Автор

@justaturtlegamer you can use any text editor and then safe the files as php or HTML even with Mac then you will also need to watch tutorial 2 in which he explains how to setup a private php server wich is needed because php is a server side scripting language. Hope I helped.

goeiecool
Автор

Thank you for this but it seems to me that the header function isn't explained here or in a previous tutorial.Any help?

ytuber
Автор

i fail in building basic programming. how could you remmber all those things? u're damn good

peace
Автор

why doesn't the \n to break the lines work when I write it as '\n' instead of "\n"?

sadmanh
Автор

thanks. but i have a quesion, how to read docx file when you no need write the name of file in script but direct from your computer ?

imelsusan
Автор

Did you remember to specify the $file? If you didn't then that's the problem. Just specify it to a txt file like : $file = "Text.txt";

serser
Автор

well if u want to get just the 1 line of the file u also have fgets(string fgets ( resource $handle [, int $length ] )) witch does exactly that link:

MeTaLRuLeee
Автор

How do i work with the code if i want only LINE 1 to be get read and echo out ?

AdvancedEXP
Автор

Can you help me? I need to parse the images and links too but I don't actually know how.

vjollcakastrati
Автор

thanks.. i have a question n i hope u can help me. how to read docx file using php ?

jessenyankee
Автор

If I only wanted every other line bold, how would I do that?

abefarrar