我想将数组转换为JSON。我的问题是该数组中的一个元素包含单引号,双引号等。
<textarea name="description" id="description">
Tesla is the living definition of bad*** and mad scientist.
During Tesla's later years, he made claims concerning a
"teleforce" weapon after studying the Van de Graaff generator.
The press called it a "peace ray" or death ray. Tesla described
the weapon as being able to be used against ground-based infantry
or for antiaircraft purposes.
</textarea>
当我提交时,我得到了:
$description = $_POST['description'];
json_encode($description);
当我解码它时,我只得到了一部分字符串。