json unescaped unicode php 5.3

时间:2014-08-25 08:31:34

标签: php json laravel unicode

我在php 5.3中的json中解析laravel中的问题列表并获得此结果

{"status":"ok","questions":[{"questionId":1,"question":"Comment appelle-t-on un petit morceau de pain long et fin que l'on trempe dans un \u0153uf \u00e0 la coque?","rightAnswer":"Une mouillette","explanation":null,"wrongAnswer1":"Une touillette","wrongAnswer2":"Une miette","wrongAnswer3":"Une grenouillette","theme":"COMMERCE","category":"BOULANGERIE","difficulty":1,"created_at":"2014-08-22 00:00:00","updated_at":"2014-08-22 00:00:00"},{"questionId":2,"question":"Quelle op\u00e9ration consiste \u00e0 m\u00e9langer la farine, l'eau, le sel et la levure pour fabriquer de la p\u00e2te \u00e0 pain?","rightAnswer":"Le p\u00e9trissage","explanation":"La p\u00e2te est diff\u00e9rente selon la technique de p\u00e9trissage utilis\u00e9e.","wrongAnswer1":"Le touillage","wrongAnswer2":"Le moulage","wrongAnswer3":"Le levage","theme":"COMMERCE","category":"BOULANGERIE","difficulty":2,"created_at":"-0001-11-30 00:00:00","updated_at":"-0001-11-30 00:00:00"},{"questionId":3,"question":"Pourquoi le boulanger fait-il des fentes sur les pains avant leur cuisson?","rightAnswer":"Pour qu'ils n'\u00e9clatent pas.","explanation":"Ces fentes qui forment de petits traits sur le pain s'appellent des \"grignes\".","wrongAnswer1":"Pour les d\u00e9corer.","wrongAnswer2":"Pour signer sa cr\u00e9ation.","wrongAnswer3":"Pour qu'ils ne gonflent pas trop.","theme":"COMMERCE","category":"BOULANGERIE","difficulty":3,"created_at":"-0001-11-30 00:00:00","updated_at":"-0001-11-30 00:00:00"}]}

这是代码

public function index()
{
    $questions = questionList::all();

    return Response::json(array(
    'status' => 'ok',
    'questions' => $questions->toArray())
    );
}

问题是json_unescaped_unicode在php 5.3中不起作用它在php 5.4中工作所以是相当于或者替换\ u0153uf \ u00e0这些éèàthx的方法:)

0 个答案:

没有答案