Jump to content

[SOLVED] file_get_contents()


adam291086

Recommended Posts

I have a simple bit of code that gets the contents of a document and displays it. It work fine with a txt document but when i use a word documet it output

 

ÐÏࡱá>þÿ *,þÿÿÿ)

 

Is this because im using the wrong function? Any Ideas?

 

<html>
<head>

</head>
<body>
<?php






// Get a file into an array.  In this example we'll go through HTTP to get
// the HTML source of a URL.

$lines = file_get_contents('adam.doc');
echo $lines;


?>
</body>
</html>

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/71637-solved-file_get_contents/
Share on other sites

It's because word documents are not plain text.. file_get_contents() only displays what you see if you open the file in "notepad"

 

you'll need to google for reading php files in PHP as i know it's simple to create them but i havn't seen many people reading them in.

 

 

Regards

Liam

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.