亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

php - How to fix file_put_contents execution failure when it contains & symbol?
滿天的星座
滿天的星座 2017-05-16 13:13:03
0
3
831

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?

滿天的星座
滿天的星座

reply all(3)
迷茫

"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.

劉奇
<?php
$filename="test.txt";
file_put_contents($filename, json_encode("ni&hao"));
?>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template