[php] jsonで エンター値が 問題になったら, 仮初めで 次 関数を…
別に 好きな 方式の 解決策は ない. するが 苦肉の策で 使った.
function parse_for_json($text) {
// Damn pesky carriage returns...
$text = str_replace("rn", "n", $text);
$text = str_replace("r", "n", $text);
// JSON requires new line characters be escaped
$text = str_replace("n", "¥n", $text);
return $text;
}
出処は ここだ.
- コメント機能はありません。コメントの代わりに[email protected]にメールを送ってください。