我的代码是这样的
$fp = fopen('text.php', 'w');
fwrite($fp, $_POST['code']);
fclose($fp);
如果$_POST['code']
包含单引号('),输出结果将是两个单引号
例如:
如果输入为'test'
如果打开text.php文件 输出结果将如下:
''test''
我还尝试使用file_put_contents()
方法,
但结果相同
如何解决这个问题?
编辑
对于$_POST['code']
;exit()
,我也得到了相同的输出结果。
wb
作为模式,而不是w
。尝试一下,看看是否解决了问题。 - Niet the Dark Absol$_POST['code']
从何处发送? - Cypher