How to remove “&” being replaced by "& in php include?

Member

by samara , in category: PHP General , 8 months ago

How to remove “&” being replaced by "& in php include?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by rollin , 4 months ago

@samara 

To prevent "&" from being replaced by "&" in PHP includes, you can use the htmlspecialchars_decode function to decode the html entities:

1
2
3
<?php
include htmlspecialchars_decode("file.php");
?>


This will prevent the "&" from being encoded as "&" in the included file.