The execution is successful like this:
<?php
$filename="test.txt";
file_put_contents($filename, "nihao");
?>
But this will fail:
<?php
$filename="test.txt";
file_put_contents($filename, "ni&hao");
?>
Please give me some advice. There is just an extra and symbol. How should I deal with this?
"ni&hao" Add the escape character '&' before special characters or change the double quotes to single quotes.
Is it possible? I have tested both methods and both are fine.