PHP Include, .html file with '


Simple one but confusing, feel slightly embaressed to ask tbh but oh well.

I’m using include(‘/somepath/somefile.html’);

inside somefile.html i have some blurb like this:

“This is some text which includes a ’ some more text… bla bla”

If i try and include the .html it doesn’t include any of the text. However if i remove the ’ then it works fine.




I am extremely sorry to have wasted your time peeps, it was a stupid mistake.

Back in the nav i forgot to add an ending ’ .

Again, very sorry.

But thank you.

Does somefile.html actually contain any markup?

I think we’d have to see the file you’re trying to include to say for certain. Could be a character encoding mismatch to the source you’re trying to include from – could be you’ve got php in that .html (which WILL execute if you use include)

Include is for code – have you tried using readfile instead? Readfile is for when you do not want the possibility of code execution… include/require is for when you want the file (regardless of it’s extension) to be checked for and allowed to execute php.

That’s weird. Sounds like there’s more than meets the eye here. All the same, you could perhaps replace the ’ with a corresponding entity reference if you want a quick fix: '

It is weird :stuck_out_tongue: but yeah that’s the other option. I have tested it with " & lots of special characters but its only ’ that seems to fail.

Any idea’s of what it might be?

It’s not my area, I’m afraid. All I can think to ask is what happens if you use


(with double quotes), but I’d be surprised if that makes a difference.

No worries.

Still same result.

Anyone else got any idea’s?